lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz TaƄczyk <golia...@polzone.pl>
Subject BlockGroupingCollector, not always getting first document
Date Thu, 08 Mar 2012 09:30:33 GMT
Hello,

I am using BlockGroupingCollector for first time and I have some small 
problem with it. Indexing code is pretty much copy of the one from docs. 
Searching looks like this:

                 Filter groupEndFilter = new CachingWrapperFilter(new 
QueryWrapperFilter(new TermQuery(new Term("last", "true"))));
...
                 BlockGroupingCollector c = new 
BlockGroupingCollector(SORT_SCORE, offset + n, false, groupEndFilter);
                 searcher.search(query, filter, c);
                 TopGroups groups = c.getTopGroups(SORT_ID, offset, 0, 
1, true);
                 if (groups != null) {
                     results.total_hits = 
groups.totalGroupCount.intValue();
                     for (int i = 0; i < groups.groups.length; i++)
                         if (groups.groups[i].totalHits > 0)
                             results.add(getResult(searcher, 
groups.groups[i].scoreDocs[0]));
                 }

So I want to get top groups for given query with documents sorted by 
their IDs. For some reason I don't always get first document from group. 
It's like every 10th group of search results does not have document with 
lowest ID on first position in scoreDocs.
ID is numeric field. Sorting groups by field values works fine.
Documents also are sorted by their IDs during indexing and I'm adding 
them as block.

What am I doing wrong?

-- 
Regards,
   Grzegorz

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