Simian
Simian

Reputation: 1640

How to update Sphinx main and delta indexes

I've read the Sphinx documentation and various resources, but I am confused about the process of maintaining main and delta indexes. Please let me know if this is correct:

The pre query SQL will update last_update_time to NOW(), which re-partitions the indexes

Confusion: Will the merge run the pre query SQL?

EDIT: How would deletion of records even work? Since the delta index would contain deleted records, records would only be removed from search queries after the delta index was merged into main?

Upvotes: 4

Views: 8359

Answers (2)

Erlandas
Erlandas

Reputation: 11

This is only half of the job. Deleted stuff must be taken care by kill list (kbatch now it is called) and then delta will not show the deleted results. But if you merge - they will reappear. To fix this - you have to do

indexer --merge main delta --merge-dst-range deleted 0 0 --rotate

But in order for this to work - you need an attribute "deleted" to be added to every result that was deleted. Then merge process will filter out results that have deleted=1 and main index will not have deleted results in it.

Upvotes: 0

Ian
Ian

Reputation: 1622

To deal with the deletes you need to take a look at the killlist, it basically defines removal criteria:

http://sphinxsearch.com/docs/manual-1.10.html#conf-sql-query-killlist

In an example I have we build our main daily, early morning then simply run a delta update (including the killlist) every 5 minutes.

On the merge stuff, I'm not sure as I've never used it.

Upvotes: 2

Related Questions