GroupingSearch does not return all the groups when using SortedSetDocValuesField [LUCENE-9017]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
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?**
---
Migrated from [LUCENE-9017](https://issues.apache.org/jira/browse/LUCENE-9017) by Juraj Kucera, updated Apr 27 2020
Contributor guide
Research direction
Start by reproducing the example with GroupingSearch, SortedSetFieldSource, SortedSetDocValuesField, and MatchAllDocsQuery. Inspect how multiple category values are handled and verify that the result contains the three expected groups: "one", "two", and "three".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100