Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

Nested Class Summary
`static class` | `FacetsCollector.MatchingDocs` Holds the documents that were matched in the `AtomicReaderContext`.

Field Summary
`protected List<FacetsCollector.MatchingDocs>` | `matchingDocs`

Constructor Summary
`protected` | `FacetsCollector(FacetsAccumulator accumulator)`

Method Summary
`static FacetsCollector` | `create(FacetsAccumulator accumulator)` Creates a `FacetsCollector` that satisfies the requirements of the given `FacetsAccumulator`.
`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)`.
`protected abstract void` | `doSetNextReader(AtomicReaderContext context)` Performs the actual work of `setNextReader(AtomicReaderContext)`.
`protected abstract void` | `finish()` Called when the Collector has finished, so that the last `FacetsCollector.MatchingDocs` can be added.
`List<FacetResult>` | `getFacetResults()` Returns a `FacetResult` per `FacetRequest` set in `FacetSearchParams`.
`List<FacetsCollector.MatchingDocs>` | `getMatchingDocs()` Returns the documents matched by the query, one `FacetsCollector.MatchingDocs` per visited segment.
`void` | `reset()` Allows to reuse the collector between search requests.
`void` | `setNextReader(AtomicReaderContext context)`

Methods inherited from class org.apache.lucene.search.Collector
`acceptsDocsOutOfOrder, collect, setScorer`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### matchingDocs

    protected final List<FacetsCollector.MatchingDocs> matchingDocs

Constructor Detail

### FacetsCollector

    protected FacetsCollector(FacetsAccumulator accumulator)

Method Detail

### 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)`.

### 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`

Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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