org.apache.lucene.facet.search
Class TaxonomyFacetsAccumulator

java.lang.Object
  extended by org.apache.lucene.facet.search.FacetsAccumulator
      extended by org.apache.lucene.facet.search.TaxonomyFacetsAccumulator
Direct Known Subclasses:
OldFacetsAccumulator

public class TaxonomyFacetsAccumulator
extends FacetsAccumulator

A FacetsAccumulator suitable for accumulating categories that were indexed into a taxonomy index.

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

Field Summary
 FacetArrays facetArrays
           
 IndexReader indexReader
           
 TaxonomyReader taxonomyReader
           
 
Fields inherited from class org.apache.lucene.facet.search.FacetsAccumulator
searchParams
 
Constructor Summary
TaxonomyFacetsAccumulator(FacetSearchParams searchParams, IndexReader indexReader, TaxonomyReader taxonomyReader)
          Initializes the accumulator with the given search params, index reader and taxonomy reader.
TaxonomyFacetsAccumulator(FacetSearchParams searchParams, IndexReader indexReader, TaxonomyReader taxonomyReader, FacetArrays facetArrays)
          Initializes the accumulator with the given parameters as well as FacetArrays.
 
Method Summary
 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.
protected  FacetResultsHandler createFacetResultsHandler(FacetRequest fr, OrdinalValueResolver resolver)
          Creates a FacetResultsHandler that matches the given FacetRequest, using the OrdinalValueResolver.
 FacetsAggregator getAggregator()
          Returns the FacetsAggregator to use for aggregating the categories found in the result documents.
protected  Map<CategoryListParams,List<FacetRequest>> groupRequests()
          Group all requests that belong to the same CategoryListParams.
 boolean requiresDocScores()
          Used by FacetsCollector to determine if document scores need to be collected in addition to matching documents.
 
Methods inherited from class org.apache.lucene.facet.search.FacetsAccumulator
create, create, emptyResult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

taxonomyReader

public final TaxonomyReader taxonomyReader

indexReader

public final IndexReader indexReader

facetArrays

public final FacetArrays facetArrays
Constructor Detail

TaxonomyFacetsAccumulator

public TaxonomyFacetsAccumulator(FacetSearchParams searchParams,
                                 IndexReader indexReader,
                                 TaxonomyReader taxonomyReader)
Initializes the accumulator with the given search params, index reader and taxonomy reader. This constructor creates the default FacetArrays, which do not support reuse. If you want to use ReusingFacetArrays, you should use the TaxonomyFacetsAccumulator(FacetSearchParams, IndexReader, TaxonomyReader) constructor.


TaxonomyFacetsAccumulator

public TaxonomyFacetsAccumulator(FacetSearchParams searchParams,
                                 IndexReader indexReader,
                                 TaxonomyReader taxonomyReader,
                                 FacetArrays facetArrays)
Initializes the accumulator with the given parameters as well as FacetArrays. Note that the accumulator doesn't call FacetArrays.free(). If you require that (only makes sense if you use ReusingFacetArrays, you should do it after you've finished with the accumulator.

Method Detail

groupRequests

protected Map<CategoryListParams,List<FacetRequest>> groupRequests()
Group all requests that belong to the same CategoryListParams.


getAggregator

public FacetsAggregator getAggregator()
Returns the FacetsAggregator to use for aggregating the categories found in the result documents.


createFacetResultsHandler

protected FacetResultsHandler createFacetResultsHandler(FacetRequest fr,
                                                        OrdinalValueResolver resolver)
Creates a FacetResultsHandler that matches the given FacetRequest, using the OrdinalValueResolver.


accumulate

public 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.

Specified by:
accumulate in class FacetsAccumulator
Parameters:
matchingDocs - the documents that matched the query, per-segment.
Throws:
IOException

requiresDocScores

public boolean requiresDocScores()
Description copied from class: FacetsAccumulator
Used by FacetsCollector to determine if document scores need to be collected in addition to matching documents.

Specified by:
requiresDocScores in class FacetsAccumulator


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