org.apache.lucene.facet.search
Class FacetsAccumulator

java.lang.Object
  extended by org.apache.lucene.facet.search.FacetsAccumulator
Direct Known Subclasses:
MultiFacetsAccumulator, RangeAccumulator, SortedSetDocValuesAccumulator, TaxonomyFacetsAccumulator

public abstract class FacetsAccumulator
extends Object

Accumulates the facets defined in the FacetSearchParams.

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

Field Summary
 FacetSearchParams searchParams
           
 
Constructor Summary
protected FacetsAccumulator(FacetSearchParams fsp)
          Constructor with the given search params.
 
Method Summary
abstract  List<FacetResult> accumulate(List<FacetsCollector.MatchingDocs> matchingDocs)
          Used by FacetsCollector to build the list of facet results that match the facet requests that were given in the constructor.
static FacetsAccumulator create(FacetSearchParams fsp, IndexReader indexReader, TaxonomyReader taxoReader, FacetArrays arrays)
          Creates a FacetsAccumulator for the given facet requests.
static FacetsAccumulator create(FacetSearchParams fsp, SortedSetDocValuesReaderState state, FacetArrays arrays)
          Creates a FacetsAccumulator for the given facet requests.
protected static FacetResult emptyResult(int ordinal, FacetRequest fr)
          Returns an empty FacetResult.
abstract  boolean requiresDocScores()
          Used by FacetsCollector to determine if document scores need to be collected in addition to matching documents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

searchParams

public FacetSearchParams searchParams
Constructor Detail

FacetsAccumulator

protected FacetsAccumulator(FacetSearchParams fsp)
Constructor with the given search params.

Method Detail

create

public static FacetsAccumulator create(FacetSearchParams fsp,
                                       IndexReader indexReader,
                                       TaxonomyReader taxoReader,
                                       FacetArrays arrays)
Creates a FacetsAccumulator for the given facet requests. This method supports RangeAccumulator and TaxonomyFacetsAccumulator by dividing the facet requests into RangeFacetRequest and the rest.

If both types of facet requests are used, it returns a MultiFacetsAccumulator and the facet results returned from accumulate(List) may not be in the same order as the given facet requests.

Parameters:
fsp - the search params define the facet requests and the FacetIndexingParams
indexReader - the IndexReader used for search
taxoReader - the TaxonomyReader used for search
arrays - the FacetArrays which the accumulator should use to store the categories weights in. Can be null.

create

public static FacetsAccumulator create(FacetSearchParams fsp,
                                       SortedSetDocValuesReaderState state,
                                       FacetArrays arrays)
                                throws IOException
Creates a FacetsAccumulator for the given facet requests. This method supports RangeAccumulator and SortedSetDocValuesAccumulator by dividing the facet requests into RangeFacetRequest and the rest.

If both types of facet requests are used, it returns a MultiFacetsAccumulator and the facet results returned from accumulate(List) may not be in the same order as the given facet requests.

Parameters:
fsp - the search params define the facet requests and the FacetIndexingParams
state - the SortedSetDocValuesReaderState needed for accumulating the categories
arrays - the FacetArrays which the accumulator should use to store the categories weights in. Can be null.
Throws:
IOException

emptyResult

protected static FacetResult emptyResult(int ordinal,
                                         FacetRequest fr)
Returns an empty FacetResult.


accumulate

public abstract List<FacetResult> accumulate(List<FacetsCollector.MatchingDocs> matchingDocs)
                                      throws IOException
Used by FacetsCollector to build the list of facet results that match the facet requests that were given in the constructor.

Parameters:
matchingDocs - the documents that matched the query, per-segment.
Throws:
IOException

requiresDocScores

public abstract boolean requiresDocScores()
Used by FacetsCollector to determine if document scores need to be collected in addition to matching documents.



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