how to index mongomapper 1 to many with sunspot / solr as its an objectId filed and not an integer?
I have a mongomapper 开发者_JS百科product and a category model and a category has many products.
I am trying to use facets using the categories like this. (seems to work in AR)
searchable do
text :name
integer :category_id, :references => ::Category
end
Problem is category_id is an ObjectId not integer so i get :
undefined method `to_i' for BSON::ObjectId(.... error when trying to index products.
Any one done this before ?
Any ideas how to do this ?
Thanks rick
精彩评论