开发者

Sunspot / SOLR not indexing STI models?

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 obj开发者_运维百科ects 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?


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜