Reputation: 5214
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
Upvotes: 1
Views: 570
Reputation: 19048
add this to your model if you want to use delta indexing:
is_indexed :fields => ['column1', 'column2'], :delta => true
Run ultrasphinx daemon:
rake ultrasphinx:daemon:start
Add to your CRON(I run it every 10 mins, but final decision is all up to your app): rake ultrasphinx:index:delta
You will need to run rake ultrasphinx:index:main once a day to move the delta contents into the main index.
Source: official documentation.
Upvotes: 1
Reputation: 3677
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.
Upvotes: 2