Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr join and faceting possible?

Tags:

join

solr

facet

Some Background info : In our application, we have a requirement to update large number of records often. I investigated solr child documents but it requires updating both the child and the parent document . Therefore, I'm investigating adding frequently updated information in an "auxillary document" with a custom defined "parent-id" field that can be used to join with the static "parent document". - basically rolling my own child document functionality.

This approach has satisfied all my requirements, except one. How can I facet upon a field present in the auxillary document?

First, here's a gist dump of my test core index (4 docs + 4 aux docs) https://gist.github.com/anonymous/2774b54e667778c71492

Next, here's a simple facet query only on the aux . While this works, it only returns auxillary documents https://gist.github.com/anonymous/a58b87576b895e467c68

Finally, I tweak the query using a SOLR join ( https://wiki.apache.org/solr/Join ) to return the main documents (which it does), but the faceting returns no results. This is what I'm hoping someone on this list can answer . Here is the gist of that query https://gist.github.com/anonymous/f3a287ab726f35b142cf

Any answers, suggestions ?

Thanks

like image 374
Vinay B Avatar asked Jul 18 '14 02:07

Vinay B


2 Answers

Updating the results of my quest. 1. It is possible with some custom coding 2. We decided to flip the main and aux documents, putting the facetable fields in the main doc. This approach works though constructing equivalent queries (to standard SOLR queries) is a PITA - involving main clauses, nested queries appended to the main queries, and filter clauses.

See discussion at http://lucene.472066.n3.nabble.com/How-do-I-get-faceting-to-work-with-Solr-JOINs-td4147785.html#a4148838

like image 114
Vinay B Avatar answered Nov 03 '22 22:11

Vinay B


You won't be able to do facets with the Join support, as it doesn't allow you to do anything with the fields from the documents you're not returning (just querying). The whole feature is limited to lookup of documents based on a value from a field, and will not merge the documents or make them available for other functionality within Solr.

You might however have more luck with the Block Join support, but that has its own caveats as well (such as deleting documents and keeping stuff in sync).

like image 26
MatsLindh Avatar answered Nov 03 '22 22:11

MatsLindh