Reputation: 2104
I have a scenario where I have a productdatabase in solr and a branddatabase in MySql. In the solr productdatabase I have a field named brandid where I refer to the Mysql primary key from the branddatabase. Now I would like to join the branddatabase for each solr searchquery and groups the result seperatly from the product results. I thought about a second solr database where I save the branddata and then join it on every query, but I would like to have each brand only one time and not merged together with the product results in the same resultset. A facette-style result for the brands is my goal. Anyone has a pointer how I could achieve this kind of results in my xml/json?
The resultset how I would like to have it in pseudo solr code:
<results>
<products>
<product>
...
</product>
<product>
...
</product>
<product>
...
</product>
<product>
...
</product>
</products>
<brands>
<brand>
...
</brand>
<brand>
...
</brand>
</brands>
</results>
Upvotes: 0
Views: 189
Reputation: 617
Can you use a higher-level language?
I currently do something similar, but I use Java as the glue. The Java application takes in requests, goes against solr using solrj, retrieves all the results, including the facets, I take that response and query against mysql to get more information, I merge all the data in the java layer and then construct the xml/json response.
other higher-level languages are offered:
Ruby,PHP,Java,Scala,Python,.Net,Perl,Javascript
Upvotes: 1
Reputation: 2583
If you only need to serve additional fields from brand database and you do not need to search/filter on them then you could apply a simple faceting on brandid
and populate the presentation fields in a post processing step from DB directly/memory cache/key value store...
and use facet.mincount=1
to eliminate the brands without any products in the current query.
Upvotes: 3