Solr commit and optimize questions

indexing, solr

Solution

Actually, committing often and optimizing makes things really slow. It's too heavy.

After a day of searching and reading stuff, I found out this:

1- Optimize causes the index to double in size while beeing optimized, and makes things really slow.

2- Committing after each add is NOT a good idea, it's better to commit a couple of times a day, and then make an optimize only once a day at most.

3- Commit should be set to "autoCommit" in the solrconfig.xml file, and there it should be tuned according to your needs.

Problem

I have a classifieds website. Users may put ads, edit ads, view ads etc. Whenever a user puts an ad, I am adding a document to Solr. I don't know, however, when to commit it. Commit slows things down from what I have read. How should I do it? Autocommit every 12 hours or so? Also, how should I do it with optimize?

Original source