lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Sokolov <msoko...@safaribooksonline.com>
Subject Re: ToChildBlockJoinQuery question
Date Thu, 22 Jan 2015 00:59:20 GMT
On 1/21/2015 6:59 PM, Gregory Dearing wrote:
> Jim,
>
> I think you hit the nail on the head... that's not what BlockJoinQueries do.
>
> If you're wanting to search for children and join to their parents... then
> use ToParentBlockJoinQuery, with a query that matches the set of children
> and a filter that matches the set of parents.
>
> If you're searching for parents, then joining to their children... then use
> ToChildBlockJoinQuery, with a query that matches the set of parents and a
> filter that matches the set of children.
>
> When you add related documents to the index (via addDocuments), make that
> children are added before their parents.
>
> The reason all the above is necessary is that it makes it possible to have
> a nested hierarchy of relationships (ie. Parents have Children, which have
> Children of their own).  You need a query to indicate which part of the
> hierarchy you're starting from, and a filter indicating which part of the
> hierarchy you're joining to.
>
> Also, you will always get an exception if your query and your filter both
> match the same document.  A child can't be its own parent.
That's true for the existing implementation, but seems unnecessary from 
what I can tell.  See 
https://github.com/safarijv/ifpress-solr-plugin/blob/master/src/main/java/com/ifactory/press/db/solr/search/SafariBlockJoinQuery.java

for a variant that allows a child to be its own parent.

-Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message