ruby on rails - Is it possible to re-use sunspot searchable declarations from other models? -
i'm using sunspot fulltext searches in customized spree webshop project.
there products, extensively indexed:
class product searchable text :description ... lots of other declarations end end
i need index orders, (via other models, don't think important), have_many products:
class order has_many :products end
the question is: want orders searchable via products, using same indexed attributes. want stay dry , not add variations of declarations on product new searchable block on order, rather "orders searchable via products". possible somehow ? docs sunspot don't mention this.
edit:
"apneadiving" suggested putting declarations in sort of shared module , re-using way. might mistaken, think can't work because sunspot dsl refers current model, declarations product not work on order.
for example, if apply searchable block example above in order, instruct sunspot index order on description, doesn't have, , doesn't me indexing products anyway.
Comments
Post a Comment