1
votes

I have a Wordpress-based website which uses Sphinx as a search engine, with a usual cron job rebuilding Sphinx index every N hours by accessing site's MySQL database. This works fine except when the post is created or edited - in that case, until the time comes to rebuild the index, it remains unindexed or indexed with obsolete attributes.

According to the Sphinx PHP API documentation only updating of the already indexed documents is allowed and there is apparently no way of adding a new document into index without rebuilding it from scratch or merging with a delta one. There is no way to remove a document from the index as well.

Besides, peeking into UpdateAttributes source code reveals that only numeric attributes are allowed to update (other types are filtered out by assertion). This makes me think that updating index on the fly isn't really welcomed by Sphinx developers.

Are there any ways around to solve that problem and to modify index not only on schedule for everything but on demand for particular documents? Or it is a bad practice with Sphinx, and using a frequently updated delta index merged with the main one is an acceptable solution even if there is only a single document to update?

Thanks in advance.

1

1 Answers

2
votes

You can try Sphinx real time indexes (http://sphinxsearch.com/docs/current.html#rt-overview) to add one single document to an existing index without rebuilding the whole index.