Search code examples
ruby-on-rails-3sphinxthinking-sphinx

customising sphinx indexes in order to search on nested attributes


Is there a way in sphinx to define indices in a custom way. Problem - I have a product model and multiple admins exists in the system. each admin can take their own notes on every product. hence notes is not a simple text field. Rather, it is a separate model. Product as well as admin has_many notes. When a admin searches the product listing, i want to make sure that he is enabled to search only through his notes.

I understand that sphinx indexes are stored in a document (internal to sphinx). For instance, all the indices of a product "dell xps" will be in a single document. It means that all the notes will be in the same document. If only i have a way to store admin_id and notes of each product into separate sphinx documents, i can acheive my requirement of searching on my notes alone. That is, a dell product will have its indices across 3 documents if 3 people has made notes about it. FYI, Similar feature exists in elastic search. any help is appreciated. Thanks in advance


Solution

  • Found out that this feature is not exploited in thinking sphinx. sad