Does anyone know how to index and search embedded documents with sunpot_mongoid?
The question has been asked in the sunspot_mongoid issues, but has no solution, so far.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just tried it. It’s a hack, but it works for searching embedded documents, and returning the parent document holding it. Is that what you want? If so, do this then. Define method that returns the embedded fields you want as an array, and then index that array.
Assuming you have class Company, with embedded departments
reindex and try to search.