org.apache.lucene.search.grouping
Class AbstractAllGroupsCollector<GROUP_VALUE_TYPE>

java.lang.Object
  extended by org.apache.lucene.search.Collector
      extended by org.apache.lucene.search.grouping.AbstractAllGroupsCollector<GROUP_VALUE_TYPE>
Direct Known Subclasses:
TermAllGroupsCollector

public abstract class AbstractAllGroupsCollector<GROUP_VALUE_TYPE>
extends Collector

A collector that collects all groups that match the query. Only the group value is collected, and the order is undefined. This collector does not determine the most relevant document of a group.

This is an abstract version. Concrete implementations define what a group actually is and how it is internally collected.

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

Constructor Summary
AbstractAllGroupsCollector()
           
 
Method Summary
 boolean acceptsDocsOutOfOrder()
          Return true if this collector does not require the matching docIDs to be delivered in int sort order (smallest to largest) to Collector.collect(int).
 int getGroupCount()
          Returns the total number of groups for the executed search.
abstract  Collection<GROUP_VALUE_TYPE> getGroups()
          Returns the group values

This is an unordered collections of group values.

 void setScorer(Scorer scorer)
          Called before successive calls to Collector.collect(int).
 
Methods inherited from class org.apache.lucene.search.Collector
collect, setNextReader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAllGroupsCollector

public AbstractAllGroupsCollector()
Method Detail

getGroupCount

public int getGroupCount()
Returns the total number of groups for the executed search. This is a convenience method. The following code snippet has the same effect:
getGroups().size()

Returns:
The total number of groups for the executed search

getGroups

public abstract Collection<GROUP_VALUE_TYPE> getGroups()
Returns the group values

This is an unordered collections of group values. For each group that matched the query there is a BytesRef representing a group value.

Returns:
the group values

setScorer

public void setScorer(Scorer scorer)
               throws IOException
Description copied from class: Collector
Called before successive calls to Collector.collect(int). Implementations that need the score of the current document (passed-in to Collector.collect(int)), should save the passed-in Scorer and call scorer.score() when needed.

Specified by:
setScorer in class Collector
Throws:
IOException

acceptsDocsOutOfOrder

public boolean acceptsDocsOutOfOrder()
Description copied from class: Collector
Return true if this collector does not require the matching docIDs to be delivered in int sort order (smallest to largest) to Collector.collect(int).

Most Lucene Query implementations will visit matching docIDs in order. However, some queries (currently limited to certain cases of BooleanQuery) can achieve faster searching if the Collector allows them to deliver the docIDs out of order.

Many collectors don't mind getting docIDs out of order, so it's important to return true here.

Specified by:
acceptsDocsOutOfOrder in class Collector


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