views:

132

answers:

2

Ruby on Rails - UltraSphinx

Hi guys, I'm using Ultrasphinx for the search thing.

My question is : I have the "rake ultrasphinx:daemon:start" running in the background. Now, should I have a cron job that does "rake ultrasphinx:index" regularly or will the daemon take care of indexing whenever a new object is created.

Please, let me know. Its kind of emergency.

Thanks

+1  A: 

You will have to run a cron job to regularly update your index. However, you can run the rake task ultrasphinx:index:delta to only update the delta index which contains recently changed records.

From time to time, you might also want to merge your delta index into your main index using the task ultrasphinx:index:merge

Hope this helps.

Buzzy
+1  A: 

add this to your model if you want to use delta indexing:

is_indexed :fields => ['column1', 'column2'], :delta => true
  1. Run ultrasphinx daemon:

    rake ultrasphinx:daemon:start

  2. Add to your CRON(I run it every 10 mins, but final decision is all up to your app): rake ultrasphinx:index:delta

  3. You will need to run rake ultrasphinx:index:main once a day to move the delta contents into the main index.

Source: official documentation.

Fedyashev Nikita
Hi Nikita, don't you think - the task to be run every 10 minutes is rake ultrasphinx:index:delta
satya
satya, right. Fixed now.
Fedyashev Nikita