org.apache.lucene.facet.search
Class FacetsCollector
java.lang.Object
org.apache.lucene.search.Collector
org.apache.lucene.facet.search.FacetsCollector
public abstract class FacetsCollector
- extends Collector
A Collector
which executes faceted search and computes the weight of
requested facets. To get the facet results you should call
getFacetResults()
.
create(FacetSearchParams, IndexReader, TaxonomyReader)
returns the
most optimized FacetsCollector
for the given parameters.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
matchingDocs
protected final List<FacetsCollector.MatchingDocs> matchingDocs
FacetsCollector
protected FacetsCollector(FacetsAccumulator accumulator)
create
public static FacetsCollector create(FacetSearchParams fsp,
IndexReader indexReader,
TaxonomyReader taxoReader)
- Creates a
FacetsCollector
using the FacetsAccumulator
from FacetsAccumulator.create(org.apache.lucene.facet.params.FacetSearchParams, org.apache.lucene.index.IndexReader, org.apache.lucene.facet.taxonomy.TaxonomyReader, org.apache.lucene.facet.search.FacetArrays)
.
create
public static FacetsCollector create(FacetsAccumulator accumulator)
- Creates a
FacetsCollector
that satisfies the requirements of the
given FacetsAccumulator
.
finish
protected abstract void finish()
- Called when the Collector has finished, so that the last
FacetsCollector.MatchingDocs
can be added.
doSetNextReader
protected abstract void doSetNextReader(AtomicReaderContext context)
throws IOException
- Performs the actual work of
setNextReader(AtomicReaderContext)
.
- Throws:
IOException
getFacetResults
public final List<FacetResult> getFacetResults()
throws IOException
- Returns a
FacetResult
per FacetRequest
set in
FacetSearchParams
. Note that if a FacetRequest
defines a
CategoryPath
which does not exist in the taxonomy, an empty
FacetResult
will be returned for it.
- Throws:
IOException
getMatchingDocs
public final List<FacetsCollector.MatchingDocs> getMatchingDocs()
- Returns the documents matched by the query, one
FacetsCollector.MatchingDocs
per
visited segment.
reset
public final void reset()
- Allows to reuse the collector between search requests. This method simply
clears all collected documents (and scores) information (as well as cached
results), and does not attempt to reuse allocated memory spaces.
setNextReader
public final void setNextReader(AtomicReaderContext context)
throws IOException
- Specified by:
setNextReader
in class Collector
- Throws:
IOException
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.