READ THIS if you use the acts_as_solr Ruby on Rails plugin

By timothynjones

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.

3 Responses to “READ THIS if you use the acts_as_solr Ruby on Rails plugin”

  1. Chris Says:

    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?

  2. richard Says:

    Hey, this didn’t work for me either, which line did you add this to, inorder to get acts_as_solr working again??

  3. Gordon Anderson Says:

    Removing the index files and reindexing solved the problem for me.

Leave a Reply