Package org.apache.lucene.facet
Class DrillSideways
- java.lang.Object
-
- org.apache.lucene.facet.DrillSideways
-
public class DrillSideways extends Object
Computes drill down and sideways counts for the providedDrillDownQuery. 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
FacetsCollectorfor 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
Nested Classes Modifier and Type Class Description static classDrillSideways.ConcurrentDrillSidewaysResult<R>static classDrillSideways.DrillSidewaysResult
-
Field Summary
Fields Modifier and Type Field Description protected FacetsConfigconfigFacetsConfigpassed to constructor.protected IndexSearchersearcherIndexSearcherpassed to constructor.protected SortedSetDocValuesReaderStatestateSortedSetDocValuesReaderStatepassed to constructor; can be null.protected TaxonomyReadertaxoReaderTaxonomyReaderpassed to constructor.
-
Constructor Summary
Constructors Constructor Description DrillSideways(IndexSearcher searcher, FacetsConfig config, SortedSetDocValuesReaderState state)Create a newDrillSidewaysinstance, assuming the categories were indexed withSortedSetDocValuesFacetField.DrillSideways(IndexSearcher searcher, FacetsConfig config, TaxonomyReader taxoReader)Create a newDrillSidewaysinstance.DrillSideways(IndexSearcher searcher, FacetsConfig config, TaxonomyReader taxoReader, SortedSetDocValuesReaderState state)Create a newDrillSidewaysinstance, where some dimensions were indexed withSortedSetDocValuesFacetFieldand others were indexed withFacetField.DrillSideways(IndexSearcher searcher, FacetsConfig config, TaxonomyReader taxoReader, SortedSetDocValuesReaderState state, ExecutorService executor)Create a newDrillSidewaysinstance, where some dimensions were indexed withSortedSetDocValuesFacetFieldand others were indexed withFacetField.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FacetsbuildFacetsResult(FacetsCollector drillDowns, FacetsCollector[] drillSideways, String[] drillSidewaysDims)Subclass can override to customize per-dim Facets impl.protected booleanscoreSubDocsAtOnce()Override this and return true if your collector (e.g.,ToParentBlockJoinCollector) expects all sub-scorers to be positioned on the document being collected.DrillSideways.DrillSidewaysResultsearch(DrillDownQuery query, int topN)Search, sorting by score, and computing drill down and sideways counts.DrillSideways.DrillSidewaysResultsearch(DrillDownQuery query, Collector hitCollector)Search, collecting hits with aCollector, and computing drill down and sideways counts.<R> DrillSideways.ConcurrentDrillSidewaysResult<R>search(DrillDownQuery query, CollectorManager<?,R> hitCollectorManager)Runs a search, using aCollectorManagerto gather and merge search resultsDrillSideways.DrillSidewaysResultsearch(DrillDownQuery query, Query filter, FieldDoc after, int topN, Sort sort, boolean doDocScores)Search, sorting bySort, and computing drill down and sideways counts.DrillSideways.DrillSidewaysResultsearch(ScoreDoc after, DrillDownQuery query, int topN)Search, sorting by score, and computing drill down and sideways counts.
-
-
-
Field Detail
-
searcher
protected final IndexSearcher searcher
IndexSearcherpassed to constructor.
-
taxoReader
protected final TaxonomyReader taxoReader
TaxonomyReaderpassed to constructor.
-
state
protected final SortedSetDocValuesReaderState state
SortedSetDocValuesReaderStatepassed to constructor; can be null.
-
config
protected final FacetsConfig config
FacetsConfigpassed to constructor.
-
-
Constructor Detail
-
DrillSideways
public DrillSideways(IndexSearcher searcher, FacetsConfig config, TaxonomyReader taxoReader)
Create a newDrillSidewaysinstance.
-
DrillSideways
public DrillSideways(IndexSearcher searcher, FacetsConfig config, SortedSetDocValuesReaderState state)
Create a newDrillSidewaysinstance, assuming the categories were indexed withSortedSetDocValuesFacetField.
-
DrillSideways
public DrillSideways(IndexSearcher searcher, FacetsConfig config, TaxonomyReader taxoReader, SortedSetDocValuesReaderState state)
Create a newDrillSidewaysinstance, where some dimensions were indexed withSortedSetDocValuesFacetFieldand others were indexed withFacetField.
-
DrillSideways
public DrillSideways(IndexSearcher searcher, FacetsConfig config, TaxonomyReader taxoReader, SortedSetDocValuesReaderState state, ExecutorService executor)
Create a newDrillSidewaysinstance, where some dimensions were indexed withSortedSetDocValuesFacetFieldand others were indexed withFacetField.Use this constructor to use the concurrent implementation and/or the CollectorManager
-
-
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 aCollector, and computing drill down and sideways counts.- Throws:
IOException
-
search
public DrillSideways.DrillSidewaysResult search(DrillDownQuery query, Query filter, FieldDoc after, int topN, Sort sort, boolean doDocScores) throws IOException
Search, sorting bySort, 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.
-
search
public <R> DrillSideways.ConcurrentDrillSidewaysResult<R> search(DrillDownQuery query, CollectorManager<?,R> hitCollectorManager) throws IOException
Runs a search, using aCollectorManagerto gather and merge search results- Throws:
IOException
-
-