[ 
https://issues.apache.org/jira/browse/LUCENE-7701?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alan Woodward updated LUCENE-7701:
----------------------------------
    Attachment: LUCENE-7701.patch

Here's a patch implementing the idea.  Group definitions are delegated to a 
{{GroupSelector}} class, with the following methods:

* {{void setNextReader(LeafReaderContext ctx)}} - called per-segment
* {{State advanceTo(int doc)}} - advance the selector to a given doc.  State 
can be one of VALUE or SKIP
* {{T currentValue()}} - get the current group value
* {{T copyValue()}} - get a persistent copy of the current group value
* {{void setGroups(Collection<SearchGroup<T>> groups)}} - called to change the 
selector to 'second-pass' mode.  {{advanceTo(int)}} will return SKIP if the 
currentValue is not in one of these groups.

There are two implementations of this, TermGroupSelector and 
ValueSourceGroupSelector, replacing the current {{term}} and {{function}} 
package Collectors.  

The patch converts FirstPass, AllGroups, AllGroupHeads and 
SecondPassCollectors.  I haven't yet worked on the DistinctValues or GroupFacet 
collectors, but they should be convertible in the same way.

> Refactor grouping collectors
> ----------------------------
>
>                 Key: LUCENE-7701
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7701
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Alan Woodward
>         Attachments: LUCENE-7701.patch
>
>
> Grouping currently works via abstract collectors, which need to be overridden 
> for each way of defining a group - currently we have two, 'term' (based on 
> SortedDocValues) and 'function' (based on ValueSources).  These collectors 
> all have a lot of repeated code, and means that if you want to implement your 
> own group definitions, you need to override four or five different classes.
> This would be easier to deal with if instead the 'group selection' code was 
> abstracted out into a single interface, and the various collectors were 
> changed to concrete implementations.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to