[ https://issues.apache.org/jira/browse/LUCENE-9017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17093329#comment-17093329 ]
Alan Woodward commented on LUCENE-9017: --------------------------------------- SortedSetFieldSource by default chooses the minimum value for each document. I don't think there's a way of grouping by all possible values at the moment, the various collectors all assume one grouping value per document. > GroupingSearch does not return all the groups when using > SortedSetDocValuesField > -------------------------------------------------------------------------------- > > Key: LUCENE-9017 > URL: https://issues.apache.org/jira/browse/LUCENE-9017 > Project: Lucene - Core > Issue Type: Bug > Components: core/search > Affects Versions: 8.2 > Reporter: Juraj Kucera > Priority: Major > > I managed to retrieve the groups using the *SortedSetDocValuesField* in > *GroupingSearch* by initializing the groupsearch with *SortedSetFieldSource* > The problem is when a document has multiple values in the field > "SortedSetDocValuesField" than not the grouping query does not return all > the groups. > Let me demonstrate it in my example > // indexing, the first object has the category "one" and the second object > has category "two" and "three" > Document doc = new Document(); > doc.add(new FacetField("Author", "Bob")); > doc.add(new SortedSetDocValuesField("category", new BytesRef("one"))); > indexWriter.addDocument(config.build(taxoWriter, doc)); > doc = new Document(); > doc.add(new FacetField("Author", "Lisa")); > doc.add(new SortedSetDocValuesField("category", new BytesRef("two"))); > doc.add(new SortedSetDocValuesField("category", new BytesRef("three"))); > indexWriter.addDocument(config.build(taxoWriter, doc)); > // initializing the grouping search > ValueSource vs = new SortedSetFieldSource(groupField); > groupingSearch = new GroupingSearch(vs, new HashMap<>()); > // performing the group search > TopGroups groups = groupingSearch.search(searcher, new MatchAllDocsQuery(), > 0, 100); > It returns 2 groups only and I would expect 3 groups ("one", "two" and > "three") > *Is it a bug or am I using the API in a wrong way?* -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org