[ 
https://issues.apache.org/jira/browse/LUCENE-7341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15336179#comment-15336179
 ] 

Michael McCandless commented on LUCENE-7341:
--------------------------------------------

It's a little spooky we need to make so many API changes to so many collectors 
... can we maybe instead just have a custom collector that knows how to early 
terminate specifically for grouping collectors?

> EarlyTerminatingSortingCollector support for grouped searches
> -------------------------------------------------------------
>
>                 Key: LUCENE-7341
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7341
>             Project: Lucene - Core
>          Issue Type: New Feature
>            Reporter: Christine Poerschke
>            Assignee: Christine Poerschke
>            Priority: Minor
>
> Currently grouped searches must not use the early terminating sorting 
> collector because the wrong results would be returned. This ticket proposes 
> to change the {{EarlyTerminatingSortingCollector}} class and probably the 
> {{LeafCollector}} interface to support early termination for grouped searches.
> *Illustration (aaa is an as yet unnamed boolean flag):*
> {code}
> # fictitious (sorted by X) segment
> | doc key | D0 D1 D2 D3 D4 D5 ... D10 D11 D12 D13 D14 D15 ... D20 D21 D22 D23 
> D24 D25 ...
> | doc grp | G0 G0 G0 G0 G0 G0 ... D10 G10 G10 G10 G10 G10 ... G20 G20 G20 G20 
> G20 G20 ... 
> {code}
> {code}
> # query with rows=3 sort=X group=false
> | query result | D0 D1 D2
> # existing code:
> #   use a EarlyTerminatingSortingCollector with numDocsToCollect=3
> #   EarlyTerminatingSortingCollector.getLeafCollector returns a LeafCollector
> #   whose collect method uses (++numCollected >= numDocsToCollect) as the 
> terminating condition
> {code}
> {code}
> # query with rows=3 sort=X group=true group.field=grp group.sort=X 
> group.limit=1
> | query result | G0(D0) G10(D10) G20(D20)
> # existing code:
> #   cannot use EarlyTerminatingSortingCollector (query result would wrongly 
> be just 'G0(D0)')
> # proposed new code:
> #   use a EarlyTerminatingSortingCollector(... numDocsToCollect=3 aaa=true)
> {code}
> {code}
> # query with rows=3 sort=X group=true group.field=grp group.sort=X 
> group.limit=5
> | query result | G0(D0,D1,D2,D3,D4) G10(D10,D11,D12,D13,D14) 
> G20(D20,D21,D22,D23,D24)
> # existing code:
> #   cannot use EarlyTerminatingSortingCollector (query result would wrongly 
> be just 'G0(D0,D1,D2)')
> # proposed new code:
> #   use a EarlyTerminatingSortingCollector(... numDocsToCollect=3 aaa=true)
> {code} 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to