org.apache.lucene.search.grouping.function
Class FunctionFirstPassGroupingCollector

java.lang.Object
  extended by org.apache.lucene.search.Collector
      extended by org.apache.lucene.search.grouping.AbstractFirstPassGroupingCollector<MutableValue>
          extended by org.apache.lucene.search.grouping.function.FunctionFirstPassGroupingCollector

public class FunctionFirstPassGroupingCollector
extends AbstractFirstPassGroupingCollector<MutableValue>

Concrete implementation of AbstractFirstPassGroupingCollector that groups based on ValueSource instances.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Field Summary
 
Fields inherited from class org.apache.lucene.search.grouping.AbstractFirstPassGroupingCollector
orderedGroups
 
Constructor Summary
FunctionFirstPassGroupingCollector(ValueSource groupByVS, Map<?,?> vsContext, Sort groupSort, int topNGroups)
          Creates a first pass collector.
 
Method Summary
protected  MutableValue copyDocGroupValue(MutableValue groupValue, MutableValue reuse)
          Returns a copy of the specified group value by creating a new instance and copying the value from the specified groupValue in the new instance.
protected  MutableValue getDocGroupValue(int doc)
          Returns the group value for the specified doc.
 void setNextReader(AtomicReaderContext readerContext)
           
 
Methods inherited from class org.apache.lucene.search.grouping.AbstractFirstPassGroupingCollector
acceptsDocsOutOfOrder, collect, getTopGroups, setScorer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionFirstPassGroupingCollector

public FunctionFirstPassGroupingCollector(ValueSource groupByVS,
                                          Map<?,?> vsContext,
                                          Sort groupSort,
                                          int topNGroups)
                                   throws IOException
Creates a first pass collector.

Parameters:
groupByVS - The ValueSource instance to group by
vsContext - The ValueSource context
groupSort - The Sort used to sort the groups. The top sorted document within each group according to groupSort, determines how that group sorts against other groups. This must be non-null, ie, if you want to groupSort by relevance use Sort.RELEVANCE.
topNGroups - How many top groups to keep.
Throws:
IOException - When I/O related errors occur
Method Detail

getDocGroupValue

protected MutableValue getDocGroupValue(int doc)
Description copied from class: AbstractFirstPassGroupingCollector
Returns the group value for the specified doc.

Specified by:
getDocGroupValue in class AbstractFirstPassGroupingCollector<MutableValue>
Parameters:
doc - The specified doc
Returns:
the group value for the specified doc

copyDocGroupValue

protected MutableValue copyDocGroupValue(MutableValue groupValue,
                                         MutableValue reuse)
Description copied from class: AbstractFirstPassGroupingCollector
Returns a copy of the specified group value by creating a new instance and copying the value from the specified groupValue in the new instance. Or optionally the reuse argument can be used to copy the group value in.

Specified by:
copyDocGroupValue in class AbstractFirstPassGroupingCollector<MutableValue>
Parameters:
groupValue - The group value to copy
reuse - Optionally a reuse instance to prevent a new instance creation
Returns:
a copy of the specified group value

setNextReader

public void setNextReader(AtomicReaderContext readerContext)
                   throws IOException
Overrides:
setNextReader in class AbstractFirstPassGroupingCollector<MutableValue>
Throws:
IOException


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.