avis
avis

Reputation: 599

Haystack and solr : new records not indexed

I am implementing search feature with Django + haystack + Solr.

Initially i had 3 records and executed 'manage.py rebuild_index' command and it indexed 3 records. These records started showing in results. From Admin console, I added a new record. This is not showing up in the search results.

But when execute, 'manage.py rebuild_index' command once again, it says indexing 4 records and then the new record shows up in the result.

Thanks

Upvotes: 1

Views: 501

Answers (1)

Mark Lavin
Mark Lavin

Reputation: 25164

The default SearchIndex does not automatically index new items. This means you need to periodically call update_index to keep in the Solr index current.

Another option is to use the RealTimeSearchIndex which does add items to the search index as they are created. http://docs.haystacksearch.org/dev/searchindex_api.html#realtimesearchindex

A third option is to use a QueuedSearchIndex as recommended in the Haystack best practices. For this you can see these two additional applications: https://github.com/toastdriven/queued_search or https://github.com/ennio/celery-haystack.

Upvotes: 1

Related Questions