Sphinx, how to determine way to update indexes?
Interested in using Sphinx for my application. Planning to install their latest version which is 2.x. Then use the Sphinx php api. My question is, I see how to install sphinx and setup the config file, but how do I setup the indexer to update the index for sphinx? I am reading different 开发者_如何学编程things and dont know what exactly to do. I read to setup a cron job to run the indexer with --all to update the index every 5 minutes, I have read about delta index, real time index. I dont know which ones to do or if they are even related. I read the manual but still confused on what to do to update the index for sphinx. Can anyone help explain it better or point to additional documentation that can help me better understand this?
*EDIT* So after doing some additional research I would assume delta would be the way to go. There are a lot of entries in the database and there are a lot of inserts and updates to the database as well. But still confused how to set this up, would delta be the answer for this situation?
so the answer is a combination of all of what you mentioned. in the most simple setup, you just have one index, and update it via a cron every n minutes. this is fine for less amounts of data.
if you have a large amount of data, this solution doesn't work well because indexing becomes really slow (imagine doing that select all on a table with tons of rows). to solve this problem, you use a delta index. a delta index basically says, "give me the new rows starting from the id i last indexed," (as opposed to the primary index, which says, "give me all the rows in this table"). you then have two crons - one to update this delta index every n minutes, and one to "merge" the two indexes (at a much less frequent rate).
see this url for more info and a more detailed how-to: http://vocecommunications.com/blog/2010/09/extending-wordpress-search-with-sphinx-part-iii/
精彩评论