public class FacetingAccumulator extends BasicAccumulator implements FacetValueAccumulator
FacetingAccumulator
manages the StatsCollectors and Expressions for facets.Modifier and Type | Class and Description |
---|---|
static class |
FacetingAccumulator.EntryComparator
A comparator to compare expression values for field facet sorting.
|
Modifier and Type | Field and Description |
---|---|
protected AnalyticsRequest |
analyticsRequest |
protected boolean |
basicsAndFieldFacetsComputed |
protected List<FieldFacetAccumulator> |
facetAccumulators |
protected Map<String,Map<String,StatsCollector[]>> |
fieldFacetCollectors |
protected Map<String,Map<String,Expression[]>> |
fieldFacetExpressions |
protected Set<String> |
hiddenFieldFacets |
protected LeafReaderContext |
leaf |
protected int |
leafNum |
static String |
MISSING_VALUE |
protected long |
queryCount |
protected Map<String,Map<String,StatsCollector[]>> |
queryFacetCollectors |
protected Map<String,Map<String,Expression[]>> |
queryFacetExpressions |
protected List<QueryFacetRequest> |
queryFacets |
protected SolrQueryRequest |
queryRequest
the current value of this stat field
|
protected Map<String,Map<String,StatsCollector[]>> |
rangeFacetCollectors |
protected Map<String,Map<String,Expression[]>> |
rangeFacetExpressions |
protected List<RangeFacetRequest> |
rangeFacets |
context, docs, expressionNames, expressions, expressionStrings, hiddenExpressions, request, searcher, statsCollectorArraySupplier, statsCollectors
Constructor and Description |
---|
FacetingAccumulator(SolrIndexSearcher searcher,
DocSet docs,
AnalyticsRequest request,
SolrQueryRequest queryRequest) |
Modifier and Type | Method and Description |
---|---|
void |
collect(int doc)
Called from Analytics stats, adds documents to the field
facets and the super
BasicAccumulator . |
void |
collectField(int doc,
String facetField,
String facetValue)
Given a document, fieldFacet field and facetValue, adds the document to the
StatsCollector s held in the bucket corresponding to the fieldFacet field and facetValue. |
void |
collectQuery(int doc,
String facetName,
String query)
Given a document, queryFacet name and query, adds the document to the
StatsCollector s held in the bucket corresponding to the queryFacet name and query. |
void |
collectRange(int doc,
String facetField,
String range)
Given a document, rangeFacet field and range, adds the document to the
StatsCollector s held in the bucket corresponding to the rangeFacet field and range. |
void |
compute()
Finalizes the statistics within the each facet bucket before exporting;
|
void |
computeQueryFacet(String facet)
Finalizes the statistics within the a specific query facet before exporting;
|
void |
computeRangeFacet(String facet)
Finalizes the statistics within the a specific range facet before exporting;
|
static FacetingAccumulator |
create(SolrIndexSearcher searcher,
DocSet docs,
AnalyticsRequest request,
SolrQueryRequest queryRequest) |
protected void |
doSetNextReader(LeafReaderContext context)
Update the readers for the
BasicAccumulator , field facets and field facet StatsCollector s. |
NamedList<?> |
export() |
NamedList<?> |
export(Expression[] expressionArr)
Exports a list of expressions as a NamedList
|
long |
getNumQueries()
Used for JMX stats collecting.
|
String |
getQueryResult(String currentFacet,
String expressionName,
String queryFacet,
String facetValue)
Returns the value of an expression to use in a range or query facet.
|
String |
getResult(String expressionName,
String fieldFacet,
String facetValue)
Returns the value of an expression to use in a range or query facet.
|
void |
postProcess()
Processes the query and range facets.
|
void |
processQueryFacets(Filter filter)
Initiates the collecting of query facets
|
void |
processRangeFacets(Filter filter)
Initiates the collecting of range facets
|
void |
setQueryStatsCollectorReaders(LeafReaderContext context)
Updates the reader for all of the query facet
StatsCollector s. |
void |
setRangeStatsCollectorReaders(LeafReaderContext context)
Updates the reader for all of the range facet
StatsCollector s. |
create, getNumStatsCollectors, getResult, makeExpressions, needsScores
getLeafCollector, setScorer
public static final String MISSING_VALUE
protected boolean basicsAndFieldFacetsComputed
protected int leafNum
protected LeafReaderContext leaf
protected final AnalyticsRequest analyticsRequest
protected final Map<String,Map<String,Expression[]>> fieldFacetExpressions
protected final Map<String,Map<String,Expression[]>> rangeFacetExpressions
protected final Map<String,Map<String,Expression[]>> queryFacetExpressions
protected final Map<String,Map<String,StatsCollector[]>> fieldFacetCollectors
protected final Map<String,Map<String,StatsCollector[]>> rangeFacetCollectors
protected final Map<String,Map<String,StatsCollector[]>> queryFacetCollectors
protected final List<FieldFacetAccumulator> facetAccumulators
protected final SolrQueryRequest queryRequest
protected List<RangeFacetRequest> rangeFacets
protected List<QueryFacetRequest> queryFacets
protected long queryCount
public FacetingAccumulator(SolrIndexSearcher searcher, DocSet docs, AnalyticsRequest request, SolrQueryRequest queryRequest) throws IOException
IOException
public static FacetingAccumulator create(SolrIndexSearcher searcher, DocSet docs, AnalyticsRequest request, SolrQueryRequest queryRequest) throws IOException
IOException
protected void doSetNextReader(LeafReaderContext context) throws IOException
BasicAccumulator
, field facets and field facet StatsCollector
s.doSetNextReader
in class BasicAccumulator
context
- The context to read documents from.IOException
- if there is an error setting the next readerpublic void setRangeStatsCollectorReaders(LeafReaderContext context) throws IOException
StatsCollector
s.setRangeStatsCollectorReaders
in interface FacetValueAccumulator
context
- The context to read documents from.IOException
- if there is an error setting the next readerpublic void setQueryStatsCollectorReaders(LeafReaderContext context) throws IOException
StatsCollector
s.setQueryStatsCollectorReaders
in interface FacetValueAccumulator
context
- The context to read documents from.IOException
- if there is an error setting the next readerpublic void collect(int doc) throws IOException
BasicAccumulator
.collect
in interface LeafCollector
collect
in class BasicAccumulator
doc
- Document to collect fromIOException
public void collectField(int doc, String facetField, String facetValue) throws IOException
StatsCollector
s held in the bucket corresponding to the fieldFacet field and facetValue.
Called during initial document collection.collectField
in interface FacetValueAccumulator
IOException
public void collectRange(int doc, String facetField, String range) throws IOException
StatsCollector
s held in the bucket corresponding to the rangeFacet field and range.
Called during post processing.collectRange
in interface FacetValueAccumulator
IOException
public void collectQuery(int doc, String facetName, String query) throws IOException
StatsCollector
s held in the bucket corresponding to the queryFacet name and query.
Called during post processing.collectQuery
in interface FacetValueAccumulator
IOException
public void compute()
compute
in class BasicAccumulator
public void computeQueryFacet(String facet)
public void computeRangeFacet(String facet)
public String getResult(String expressionName, String fieldFacet, String facetValue)
expressionName
- the name of the expressionfieldFacet
- the facet fieldfacetValue
- the facet valuepublic String getQueryResult(String currentFacet, String expressionName, String queryFacet, String facetValue)
currentFacet
- the name of the current facetexpressionName
- the name of the expressionqueryFacet
- the facet queryfacetValue
- the field valuepublic NamedList<?> export()
export
in class BasicAccumulator
public NamedList<?> export(Expression[] expressionArr)
expressionArr
- an array of expressionspublic void postProcess() throws IOException
postProcess
in class ValueAccumulator
IOException
public void processQueryFacets(Filter filter) throws IOException
filter
- the base filter to work againstIOException
- if searching failedpublic long getNumQueries()
BasicAccumulator
getNumQueries
in class BasicAccumulator
public void processRangeFacets(Filter filter) throws IOException
filter
- the base filter to useIOException
- if searching failsCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.