Hi David,

Yes we have migrated most of the result grouping use case to "Collapse &
Expand" as the official solr doc suggested, there are just a few that we
can't really migrate yet.

I'll file a jira with more details and submit a PR soon

Thanks,

Yue

On Sat, Apr 5, 2025 at 12:37 PM David Smiley <dsmi...@apache.org> wrote:

> Maybe not a helpful response but I want to say anyway that you should
> consider "Collapse & Expand" before result grouping.  It's generally more
> efficient, code details are better encapsulated (which I care about, as a
> maintainer).  However, result grouping works on distributed search (shards)
> when a group may span shards.
>
> If you find a perf bug; PR welcome!
>
> On Sat, Apr 5, 2025 at 6:49 AM Yue Yu <yue...@bloomreach.com> wrote:
>
> > Hi All,
> >
> > When running vector search with grouping in multi-shard setting, the
> > KnnFloatVectorQuery is executed (2+rows) times.
> >
> > I've observed that Qtime grows linearly when I increase "rows" number
> >
> > The culprit is this function call in
> >
> >
> https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/search/grouping/distributed/command/TopGroupsFieldCommand.java#L202
> >
> > if (needScores) {
> >   for (GroupDocs<?> group : topGroups.groups) {
> >     TopFieldCollector.populateScores(group.scoreDocs, searcher, query);
> >   }
> > }
> >
> > Where
> >
> >
> https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java#L403
> > does
> >
> > final Weight weight = searcher.createWeight(searcher.rewrite(query),
> > ScoreMode.COMPLETE, 1);
> >
> > Here, if the query is KnnFloatVectorQuery, *searcher.rewrite(query) *will
> > execute the same vector search for each topGroups.groups
> >
> > a simple fix could be moving *searcher.rewrite(query) *out of the
> > topGroups.groups loop. Thoughts?
> >
> > Best,
> >
> > Yue
> >
>

Reply via email to