Thursday, 22 August 2013

Sunspot Solr: auto_index not working

Sunspot Solr: auto_index not working

I'm using sunspot for handling solr in my spree commerce application. I've
defined it for my product model:
Spree::Product.class_eval do
searchable :auto_index => true, :auto_remove => true do
...
end
end
At index time, everything gets into Solr and works fine. But when I try to
edit a product, the changes aren't saved to Solr. For example, adding a
unique word like testtest to the title of a product, and then search for
that keyword returns nothing. When I reindex the whole database, it works.
Inside the sunspot.yml I'm using the auto_commit_after_request: true option.
I tailed the log/sunspot-solr-development.log where every search gets
logged. But it seems that editing a product doesn't make any call to Solr.
I thought that using the :auto_index => true option would trigger the
saves to the database (in production I'm going to use the autoCommit
feature from Solr).
So, I'm a little bit stuck. I have no idea, where sunspot hooks into the
save blocks, or is it RSolr in the background? Maybe someone can help me
to fix this problem.

No comments:

Post a Comment