I was perplexed by Solr searches for objects of a particular type that were returning objects of the wrong type until I found this. Basically, Foo.find_by_solr(…) returns objects of type Bar, frequently resulting in errors like
RuntimeError (Out of sync! The id 123 is in the Solr index but missing in the database!)
The fix is to add the line:
<field name="type_t" type="string" indexed="true" stored="true" required="true"/>
to the file vendor/plugins/acts_as_solr/solr/solr/conf/schema.xml.
This bug has been open for three months but still not addressed, despite the seriousness of it.
April 23, 2008 at 8:02 am |
I just added that line to the schema.xml but it does not solve the problem for me. What does this particular line do anyways?
September 7, 2008 at 8:47 pm |
Hey, this didn’t work for me either, which line did you add this to, inorder to get acts_as_solr working again??
September 22, 2008 at 1:46 am |
Removing the index files and reindexing solved the problem for me.