Sphinx Thinking - Table Based Reindexing

Re-indexing the Thinking Sphinx indexes in my development configuration takes several hours, mainly due to several huge tables (we do not use delta updates). Even when I change the index to another, much smaller table, reindexing takes more than an hour, due to the presence of large tables.

Is there a way to get TS to re-index only the specified table in db?

+4
source share
2 answers

It is not possible to tell Thinking Sphinx to process one index at a time, but it is certainly possible (and not particularly difficult) using the Sphinx index index tool directly.

indexer --config config/development.sphinx.conf model_core 

A few notes: if you do not specify the proper names for the index definitions, the model name will be specified by default, reduced and underlined with the suffix _core. If you had delta indices in the game, they would have the _delta suffix. Also, add the --rotate flag to this call if Sphinx is running.

You can specify as many indexes as you want. If you ever want to process all indexes at once (just like Thake Sphinx rake task), --all will do it for you.

As an aside - how many records are we talking about? How complicated are your index definitions? Several hours of processing indexes are not ordinary. Do you have database indexes for any foreign key columns used by associations specified in Sphinx indexes?

+10
source

I wrote for this function (rather dumb) BASH. Note that it must be run from the root of your project.

 # "rebuild" one index at a time function rebuildts { echo "rake ts:stop" && rake ts:stop echo "rake ts:configure" && rake ts:configure echo "Runnning indexer" indexer --config config/development.sphinx.conf $1 echo "rake ts:start" && rake ts:start } 

Usage: rebuildts my_model_core

+1
source

Source: https://habr.com/ru/post/1390305/


All Articles