Question

I have a couple of models in a Rails (2.3.11) application that are built using STI, and arranged as such:

Gallery::Base < ActiveRecord::Base (indexed for SOLR)

Gallery::Local < Gallery::Base (indexed for SOLR)

Gallery::Remote < Gallery::Base (not indexed)

I am finding disparate results regarding the indexing of these models. In my current development database I have 77 Gallery::Local objects and no Gallery::Remote objects (which also means there are 77 Gallery::Base objects in the db)

The problem is that either Sunspot.search(Gallery::Base) as well as Sunspot.search(Gallery::Local) returns a single hit.

Now for the stranger part: on a colleague's computer using the production database (with hundreds of Gallery::Local objects), no hit whatsoever is returned from either Sunspot.search(Gallery::Base) or Sunspot.search(Gallery::Local)!

On a side note, I have tried having the index on both Gallery::Base and Gallery::Local, and in each one separately and reindexing, with the same results. I also have a number of other indexed models for which the full text search works as intended.

Anyone have any idea as what's causing this?

Was it helpful?

Solution

Actually found out what the problem was. If anyone's interested, the sunspot:reindex task does not contemplate namespaced and 'moduled' models.

Check out this pull request on github for a fix (go to the Diff section).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top