org.apache.lucene.facet
Class DrillSideways

java.lang.Object
  extended by org.apache.lucene.facet.DrillSideways

public class DrillSideways
extends Object

Computes drill down and sideways counts for the provided DrillDownQuery. Drill sideways counts include alternative values/aggregates for the drill-down dimensions so that a dimension does not disappear after the user drills down into it.

Use one of the static search methods to do the search, and then get the hits and facet results from the returned DrillSideways.DrillSidewaysResult.

NOTE: this allocates one FacetsCollector for each drill-down, plus one. If your index has high number of facet labels then this will multiply your memory usage.

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

Nested Class Summary
static class DrillSideways.DrillSidewaysResult
          Result of a drill sideways search, including the Facets and TopDocs.
 
Field Summary
protected  FacetsConfig config
          FacetsConfig passed to constructor.
protected  IndexSearcher searcher
          IndexSearcher passed to constructor.
protected  SortedSetDocValuesReaderState state
          SortedSetDocValuesReaderState passed to constructor; can be null.
protected  TaxonomyReader taxoReader
          TaxonomyReader passed to constructor.
 
Constructor Summary
DrillSideways(IndexSearcher searcher, FacetsConfig config, SortedSetDocValuesReaderState state)
          Create a new DrillSideways instance, assuming the categories were indexed with SortedSetDocValuesFacetField.
DrillSideways(IndexSearcher searcher, FacetsConfig config, TaxonomyReader taxoReader)
          Create a new DrillSideways instance.
DrillSideways(IndexSearcher searcher, FacetsConfig config, TaxonomyReader taxoReader, SortedSetDocValuesReaderState state)
          Create a new DrillSideways instance, where some dimensions were indexed with SortedSetDocValuesFacetField and others were indexed with FacetField.
 
Method Summary
protected  Facets buildFacetsResult(FacetsCollector drillDowns, FacetsCollector[] drillSideways, String[] drillSidewaysDims)
          Subclass can override to customize per-dim Facets impl.
protected  boolean scoreSubDocsAtOnce()
          Override this and return true if your collector (e.g., ToParentBlockJoinCollector) expects all sub-scorers to be positioned on the document being collected.
 DrillSideways.DrillSidewaysResult search(DrillDownQuery query, Collector hitCollector)
          Search, collecting hits with a Collector, and computing drill down and sideways counts.
 DrillSideways.DrillSidewaysResult search(DrillDownQuery query, Filter filter, FieldDoc after, int topN, Sort sort, boolean doDocScores, boolean doMaxScore)
          Search, sorting by Sort, and computing drill down and sideways counts.
 DrillSideways.DrillSidewaysResult search(DrillDownQuery query, int topN)
          Search, sorting by score, and computing drill down and sideways counts.
 DrillSideways.DrillSidewaysResult search(ScoreDoc after, DrillDownQuery query, int topN)
          Search, sorting by score, and computing drill down and sideways counts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

searcher

protected final IndexSearcher searcher
IndexSearcher passed to constructor.


taxoReader

protected final TaxonomyReader taxoReader
TaxonomyReader passed to constructor.


state

protected final SortedSetDocValuesReaderState state
SortedSetDocValuesReaderState passed to constructor; can be null.


config

protected final FacetsConfig config
FacetsConfig passed to constructor.

Constructor Detail

DrillSideways

public DrillSideways(IndexSearcher searcher,
                     FacetsConfig config,
                     TaxonomyReader taxoReader)
Create a new DrillSideways instance.


DrillSideways

public DrillSideways(IndexSearcher searcher,
                     FacetsConfig config,
                     SortedSetDocValuesReaderState state)
Create a new DrillSideways instance, assuming the categories were indexed with SortedSetDocValuesFacetField.


DrillSideways

public DrillSideways(IndexSearcher searcher,
                     FacetsConfig config,
                     TaxonomyReader taxoReader,
                     SortedSetDocValuesReaderState state)
Create a new DrillSideways instance, where some dimensions were indexed with SortedSetDocValuesFacetField and others were indexed with FacetField.

Method Detail

buildFacetsResult

protected Facets buildFacetsResult(FacetsCollector drillDowns,
                                   FacetsCollector[] drillSideways,
                                   String[] drillSidewaysDims)
                            throws IOException
Subclass can override to customize per-dim Facets impl.

Throws:
IOException

search

public DrillSideways.DrillSidewaysResult search(DrillDownQuery query,
                                                Collector hitCollector)
                                         throws IOException
Search, collecting hits with a Collector, and computing drill down and sideways counts.

Throws:
IOException

search

public DrillSideways.DrillSidewaysResult search(DrillDownQuery query,
                                                Filter filter,
                                                FieldDoc after,
                                                int topN,
                                                Sort sort,
                                                boolean doDocScores,
                                                boolean doMaxScore)
                                         throws IOException
Search, sorting by Sort, and computing drill down and sideways counts.

Throws:
IOException

search

public DrillSideways.DrillSidewaysResult search(DrillDownQuery query,
                                                int topN)
                                         throws IOException
Search, sorting by score, and computing drill down and sideways counts.

Throws:
IOException

search

public DrillSideways.DrillSidewaysResult search(ScoreDoc after,
                                                DrillDownQuery query,
                                                int topN)
                                         throws IOException
Search, sorting by score, and computing drill down and sideways counts.

Throws:
IOException

scoreSubDocsAtOnce

protected boolean scoreSubDocsAtOnce()
Override this and return true if your collector (e.g., ToParentBlockJoinCollector) expects all sub-scorers to be positioned on the document being collected. This will cause some performance loss; default is false. Note that if you return true from this method (in a subclass) be sure your collector also returns false from Collector.acceptsDocsOutOfOrder(): this will trick BooleanQuery into also scoring all subDocs at once.



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