I need help constructing a Solr query that will not only search child documents and return the parent, but also search on the parent. Please see my example schema below:
Manufacturer
- Id
- Name
- Comments
Products
- Id
- ManufacturerId
- ProductName
All Solr documents have a unique ID field, but Products have a special field "ManufacturerId" that acts as a foreign key.
I would like to search all products that have the name "iPod" and return the parent "Manufacturer" documents. I can accomplish by using the following Join statement.
{!join from=ManufacturerId to=Id}ProductName:iPod
In addition, I would like to pull back Manufacturers that have iPod in Comments. Therefore the result would include all manufacturers that have iPod products and have the word iPod in it's comments field. I've tried the following with no luck.
{!join from=ManufacturerId to=Id}ProductName:iPod OR Comments:iPod
Any help would be greatly appreciated.
Thanks!!
UPDATE:
It seems to work correctly when I use the filter query 'fq' field as opposed to the regular query field 'q'. I'm unsure if this is the best solution. Also, I wonder if relevancy will work the same way. Better solutions appreciated.
Comments:iPod {!join from=RouteId to=Id}ProductName:iPod
or
iPod {!join from=RouteId to=Id}ProductName:iPod
Using query tells Solr that another query should be made that will affect the result list.
q=