lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bamford <>
Subject Re: More questions on BlockJoinQuery
Date Wed, 20 Feb 2013 15:48:22 GMT

 Thanks Mike.
I have downloaded the source tarball for 4.1.0 and have tried to get it working, but am having
a few problems getting it to fit with my environment (intelliJ / Maven).
Where is the best forum to discuss such issues?




-----Original Message-----
From: Michael McCandless <>
Sent: Tue, 12 Feb 2013 15:17
Subject: Re: More questions on BlockJoinQuery

On Tue, Feb 12, 2013 at 7:43 AM, Chris Bamford
<> wrote:

>> Could you please send this to the list?
> I thought I did!  :-)  Here it is again:

Duh, my bad :)  You are right!

I saw the "Hi Mike" and stopped there!

Responses below:

> I have a question about your post "Searching relational content with Lucene's
> BlockJoinQuery"
> (
> I am actually trying to use Lucene 4.0.0, so am having to translate your 
example to
> the newer ToParentBlockJoinQuery / ToChildBlockJoinQuery APIs.  I have had 
some success,
> but my ultimate goal of combining the info from both child and parent hits is 
> me.  I  suspect I am missing something, but as yet haven't figured out what!
> In this scenario, let's say I have the following relationship:
> child 1 :   ref:"100", content:"child 1", type:"C"
> child 2 :   ref:"200", content:"child 2", type:"C"
> child 3 :   ref:"300", content:"child 3", type:"C"
> parent  :   ref:"400", content:"parent", type:"P"
> When one or more children are hit, I want that to be noted against the parent,
> so ultimately I can create a result object like:
> Result{ ref:400, content:"parent", matches: [100, 300] }  // children 1 & 3
> were hit
> I have followed your example closely just replacing BlockJoinQuery with
> ToParentBlockJoinQuery and BlockJoinCollector with ToParentBlockJoinCollector.
> Unfortunately I seem to be able to get either:
> Just the parent objects (with, 10)) or just the children (with 
> Collector),  but not both!
> Am I to call search() twice (one returning TopDocs and the other GroupDocs via
> the Collector) and join them myself?  Or does one of these calls return me 
> types of documents, grouped and sorted?

You should only call once, but you should pass
your ToParentBlockJoinCollector instance, collector),
and then you call collector.getTopGroups to get the parent & children.

Maybe have a look @ the unit test to get ideas?

BTW you should upgrade to 4.1.0!

Mike McCandless

To unsubscribe, e-mail:
For additional commands, e-mail:


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message