org.apache.lucene.search.grouping.dv
Class DVAllGroupsCollector<GROUP_VALUE_TYPE>

java.lang.Object
  extended by org.apache.lucene.search.Collector
      extended by org.apache.lucene.search.grouping.AbstractAllGroupsCollector<GROUP_VALUE_TYPE>
          extended by org.apache.lucene.search.grouping.dv.DVAllGroupsCollector<GROUP_VALUE_TYPE>

public abstract class DVAllGroupsCollector<GROUP_VALUE_TYPE>
extends AbstractAllGroupsCollector<GROUP_VALUE_TYPE>

Implementation of AbstractAllGroupsCollector that groups documents based on DocValues fields.

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

Method Summary
static
<T> DVAllGroupsCollector<T>
create(String groupField, DocValues.Type type, boolean diskResident)
          Constructs a DVAllGroupsCollector.
static
<T> DVAllGroupsCollector<T>
create(String groupField, DocValues.Type type, boolean diskResident, int initialSize)
          Expert: Constructs a DVAllGroupsCollector.
protected  DocValues.Source getDefaultSource(AtomicReaderContext readerContext)
           
protected abstract  void setDocValuesSources(DocValues.Source source, AtomicReaderContext readerContext)
          Sets the idv source for concrete implementations to use.
 void setNextReader(AtomicReaderContext readerContext)
           
 
Methods inherited from class org.apache.lucene.search.grouping.AbstractAllGroupsCollector
acceptsDocsOutOfOrder, getGroupCount, getGroups, setScorer
 
Methods inherited from class org.apache.lucene.search.Collector
collect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static <T> DVAllGroupsCollector<T> create(String groupField,
                                                 DocValues.Type type,
                                                 boolean diskResident,
                                                 int initialSize)
Expert: Constructs a DVAllGroupsCollector. Selects and constructs the most optimal all groups collector implementation for grouping by DocValues.

Parameters:
groupField - The field to group by
type - The DocValues.Type which is used to select a concrete implementation.
diskResident - Whether the values to group by should be disk resident
initialSize - The initial allocation size of the internal int set and group list which should roughly match the total number of expected unique groups. Be aware that the heap usage is 4 bytes * initialSize. Not all concrete implementions use this!
Returns:
the most optimal all groups collector implementation for grouping by DocValues

create

public static <T> DVAllGroupsCollector<T> create(String groupField,
                                                 DocValues.Type type,
                                                 boolean diskResident)
Constructs a DVAllGroupsCollector. Selects and constructs the most optimal all groups collector implementation for grouping by DocValues. If implementations require an initial allocation size then this will be set to 128.

Parameters:
groupField - The field to group by
type - The DocValues.Type which is used to select a concrete implementation.
diskResident - Wether the values to group by should be disk resident
Returns:
the most optimal all groups collector implementation for grouping by DocValues

setNextReader

public void setNextReader(AtomicReaderContext readerContext)
                   throws IOException
Specified by:
setNextReader in class Collector
Throws:
IOException

setDocValuesSources

protected abstract void setDocValuesSources(DocValues.Source source,
                                            AtomicReaderContext readerContext)
Sets the idv source for concrete implementations to use.

Parameters:
source - The idv source to be used by concrete implementations
readerContext - The current reader context

getDefaultSource

protected DocValues.Source getDefaultSource(AtomicReaderContext readerContext)
Parameters:
readerContext - The current reader context
Returns:
The default source when no doc values are available.


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