lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Kaser (JIRA)" <>
Subject [jira] [Created] (LUCENE-4076) When doing nested (index-time) joins, ToParentBlockJoinCollector delivers incomplete information on the grand-children
Date Fri, 25 May 2012 09:39:24 GMT
Christoph Kaser created LUCENE-4076:

             Summary: When doing nested (index-time) joins, ToParentBlockJoinCollector delivers
incomplete information on the grand-children
                 Key: LUCENE-4076
             Project: Lucene - Java
          Issue Type: Bug
          Components: modules/join
    Affects Versions: 3.6, 3.5, 3.4
            Reporter: Christoph Kaser

ToParentBlockJoinCollector.getTopGroups does not provide the correct answer when a query with
nested ToParentBlockJoinCollectors is performed.

Given the following example query:
Query grandChildQuery=new TermQuery(new Term("color", "red"));
Filter childFilter = new CachingWrapperFilter(new RawTermFilter(new Term("type","child")),
ToParentBlockJoinQuery grandchildJoinQuery = new ToParentBlockJoinQuery(grandChildQuery, childFilter,

BooleanQuery childQuery= new BooleanQuery();
childQuery.add(grandchildJoinQuery, Occur.MUST);
childQuery.add(new TermQuery(new Term("shape", "round")), Occur.MUST);

Filter parentFilter = new CachingWrapperFilter(new RawTermFilter(new Term("type","parent")),
ToParentBlockJoinQuery childJoinQuery = new ToParentBlockJoinQuery(childQuery, parentFilter,

parentQuery=new BooleanQuery();
parentQuery.add(childJoinQuery, Occur.MUST);
parentQuery.add(new TermQuery(new Term("name", "test")), Occur.MUST);

ToParentBlockJoinCollector parentCollector= new ToParentBlockJoinCollector(Sort.RELEVANCE,
30, true, true);, null, parentCollector);

This produces the correct results:
TopGroups<Integer> childGroups = parentCollector.getTopGroups(childJoinQuery, null,
0, 20, 0, false); 

However, this does not:
TopGroups<Integer> grandChildGroups = parentCollector.getTopGroups(grandchildJoinQuery,
null, 0, 20, 0, false); 

The content of grandChildGroups is broken in the following ways:
* The groupValue is not the document id of the child document (which is the parent of a grandchild
document), but the document id of the _previous_ matching parent document
* There are only as much GroupDocs as there are parent documents (not child documents), and
they only contain the children of the last child document (but, as mentioned before, with
the wrong groupValue). 

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


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

View raw message