Package org.apache.solr.request
Class SimpleFacets
- java.lang.Object
- 
- org.apache.solr.request.SimpleFacets
 
- 
- Direct Known Subclasses:
- PivotFacetProcessor,- RangeFacetProcessor
 
 public class SimpleFacets extends Object A class that generates simple Facet information for a request.More advanced facet implementations may compose or subclass this class to leverage any of its functionality. 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classSimpleFacets.CountPair<K extends Comparable<? super K>,V extends Comparable<? super V>>A simple key=>val pair whose natural order is such that higher vals come before lower vals.protected static classSimpleFacets.ParsedParams
 - 
Field SummaryFields Modifier and Type Field Description protected DocSetdocsOrigThe main set of documents all facet counts should be relative toprotected FacetDebugInfofdebugprotected FacetDebugInfofdebugParentprotected org.apache.solr.common.params.SolrParamsglobalConfiguration params behavior should be driven byprotected ResponseBuilderrbprotected SolrQueryRequestreqprotected SolrIndexSearchersearcherSearcher to use for all calculations
 - 
Constructor SummaryConstructors Constructor Description SimpleFacets(SolrQueryRequest req, DocSet docs, org.apache.solr.common.params.SolrParams params)SimpleFacets(SolrQueryRequest req, DocSet docs, org.apache.solr.common.params.SolrParams params, ResponseBuilder rb)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidcheckMincountOnExists(String fieldName, int mincount)protected DocSetcomputeDocSet(DocSet baseDocSet, List<String> excludeTagList)DocSetgetDocsOrig()org.apache.solr.common.util.NamedList<Object>getFacetFieldCounts()Returns a list of value constraints and the associated facet counts for each facet field specified in the params.org.apache.solr.common.util.NamedList<Object>getFacetIntervalCounts()Returns aNamedListwith each entry having the "key" of the interval as name and the count of docs in that interval as value.voidgetFacetQueryCount(SimpleFacets.ParsedParams parsed, org.apache.solr.common.util.NamedList<Integer> res)org.apache.solr.common.util.NamedList<Integer>getFacetQueryCounts()Returns a list of facet counts for each of the facet queries specified in the paramsorg.apache.solr.common.util.NamedList<Integer>getFacetTermEnumCounts(SolrIndexSearcher searcher, DocSet docs, String field, int offset, int limit, int mincount, boolean missing, String sort, String prefix, String contains, boolean ignoreCase, boolean intersectsCheck)Works likegetFacetTermEnumCounts(SolrIndexSearcher, DocSet, String, int, int, int, boolean, String, String, Predicate, boolean)but takes a substring directly for the contains check rather than aPredicateinstance.org.apache.solr.common.util.NamedList<Integer>getFacetTermEnumCounts(SolrIndexSearcher searcher, DocSet docs, String field, int offset, int limit, int mincount, boolean missing, String sort, String prefix, Predicate<org.apache.lucene.util.BytesRef> termFilter, boolean intersectsCheck)Returns a list of terms in the specified field along with the corresponding count of documents in the set that match that constraint.static intgetFieldMissingCount(SolrIndexSearcher searcher, DocSet docs, String fieldName)Returns a count of the documents in the set which do not have any terms for for the specified field.org.apache.solr.common.params.SolrParamsgetGlobalParams()org.apache.solr.common.util.NamedList<Integer>getGroupedCounts(SolrIndexSearcher searcher, DocSet base, String field, boolean multiToken, int offset, int limit, int mincount, boolean missing, String sort, String prefix, Predicate<org.apache.lucene.util.BytesRef> termFilter)intgetGroupedFacetQueryCount(org.apache.lucene.search.Query facetQuery, DocSet docSet)Returns a grouped facet count for the facet queryorg.apache.solr.common.util.NamedList<Object>getHeatmapCounts()protected org.apache.solr.common.util.NamedList<Integer>getListedTermCounts(String field, SimpleFacets.ParsedParams parsed, List<String> terms)Computes the term->count counts for the specified term values relative to theSolrQueryRequestgetRequest()ResponseBuildergetResponseBuilder()org.apache.solr.common.util.NamedList<Integer>getTermCounts(String field, SimpleFacets.ParsedParams parsed)Term counts for use in field faceting that resepects the appropriate mincountorg.apache.solr.common.util.NamedList<Integer>getTermCountsForPivots(String field, SimpleFacets.ParsedParams parsed)Term counts for use in pivot faceting that resepcts the appropriate mincountprotected Predicate<org.apache.lucene.util.BytesRef>newBytesRefFilter(String field, org.apache.solr.common.params.SolrParams params)Create a new bytes ref filter for filtering facet terms.protected Predicate<org.apache.lucene.util.BytesRef>newExcludeBytesRefFilter(String field, org.apache.solr.common.params.SolrParams params)Create a new bytes ref filter for excluding facet terms.protected SimpleFacets.ParsedParamsparseParams(String type, String param)voidsetFacetDebugInfo(FacetDebugInfo fdebugParent)
 
- 
- 
- 
Field Detail- 
docsOrigprotected DocSet docsOrig The main set of documents all facet counts should be relative to
 - 
globalprotected final org.apache.solr.common.params.SolrParams global Configuration params behavior should be driven by
 - 
searcherprotected final SolrIndexSearcher searcher Searcher to use for all calculations
 - 
reqprotected final SolrQueryRequest req 
 - 
rbprotected final ResponseBuilder rb 
 - 
fdebugParentprotected FacetDebugInfo fdebugParent 
 - 
fdebugprotected FacetDebugInfo fdebug 
 
- 
 - 
Constructor Detail- 
SimpleFacetspublic SimpleFacets(SolrQueryRequest req, DocSet docs, org.apache.solr.common.params.SolrParams params) 
 - 
SimpleFacetspublic SimpleFacets(SolrQueryRequest req, DocSet docs, org.apache.solr.common.params.SolrParams params, ResponseBuilder rb) 
 
- 
 - 
Method Detail- 
setFacetDebugInfopublic void setFacetDebugInfo(FacetDebugInfo fdebugParent) 
 - 
parseParamsprotected SimpleFacets.ParsedParams parseParams(String type, String param) throws SyntaxError, IOException - Throws:
- SyntaxError
- IOException
 
 - 
computeDocSetprotected DocSet computeDocSet(DocSet baseDocSet, List<String> excludeTagList) throws SyntaxError, IOException - Throws:
- SyntaxError
- IOException
 
 - 
getFacetQueryCountspublic org.apache.solr.common.util.NamedList<Integer> getFacetQueryCounts() throws IOException, SyntaxError Returns a list of facet counts for each of the facet queries specified in the params- Throws:
- IOException
- SyntaxError
- See Also:
- FacetParams.FACET_QUERY
 
 - 
getFacetQueryCountpublic void getFacetQueryCount(SimpleFacets.ParsedParams parsed, org.apache.solr.common.util.NamedList<Integer> res) throws SyntaxError, IOException - Throws:
- SyntaxError
- IOException
 
 - 
getGroupedFacetQueryCountpublic int getGroupedFacetQueryCount(org.apache.lucene.search.Query facetQuery, DocSet docSet) throws IOExceptionReturns a grouped facet count for the facet query- Throws:
- IOException
- See Also:
- FacetParams.FACET_QUERY
 
 - 
newExcludeBytesRefFilterprotected Predicate<org.apache.lucene.util.BytesRef> newExcludeBytesRefFilter(String field, org.apache.solr.common.params.SolrParams params) Create a new bytes ref filter for excluding facet terms.This method by default uses the FacetParams.FACET_EXCLUDETERMSparameter but custom SimpleFacets classes could use a different implementation.- Parameters:
- field- the field to check for facet term filters
- params- the request parameter object
- Returns:
- A predicate for filtering terms or null if no filters are applicable.
 
 - 
newBytesRefFilterprotected Predicate<org.apache.lucene.util.BytesRef> newBytesRefFilter(String field, org.apache.solr.common.params.SolrParams params) Create a new bytes ref filter for filtering facet terms. If more than one filter is applicable the applicable filters will be returned as anPredicate.and(Predicate)of all such filters.- Parameters:
- field- the field to check for facet term filters
- params- the request parameter object
- Returns:
- A predicate for filtering terms or null if no filters are applicable.
 
 - 
getTermCountsForPivotspublic org.apache.solr.common.util.NamedList<Integer> getTermCountsForPivots(String field, SimpleFacets.ParsedParams parsed) throws IOException Term counts for use in pivot faceting that resepcts the appropriate mincount- Throws:
- IOException
- See Also:
- FacetParams.FACET_PIVOT_MINCOUNT
 
 - 
getTermCountspublic org.apache.solr.common.util.NamedList<Integer> getTermCounts(String field, SimpleFacets.ParsedParams parsed) throws IOException Term counts for use in field faceting that resepects the appropriate mincount- Throws:
- IOException
- See Also:
- FacetParams.FACET_MINCOUNT
 
 - 
getGroupedCountspublic org.apache.solr.common.util.NamedList<Integer> getGroupedCounts(SolrIndexSearcher searcher, DocSet base, String field, boolean multiToken, int offset, int limit, int mincount, boolean missing, String sort, String prefix, Predicate<org.apache.lucene.util.BytesRef> termFilter) throws IOException - Throws:
- IOException
 
 - 
getFacetFieldCountspublic org.apache.solr.common.util.NamedList<Object> getFacetFieldCounts() throws IOException, SyntaxError Returns a list of value constraints and the associated facet counts for each facet field specified in the params.- Throws:
- IOException
- SyntaxError
- See Also:
- FacetParams.FACET_FIELD,- getFieldMissingCount(org.apache.solr.search.SolrIndexSearcher, org.apache.solr.search.DocSet, java.lang.String),- getFacetTermEnumCounts(org.apache.solr.search.SolrIndexSearcher, org.apache.solr.search.DocSet, java.lang.String, int, int, int, boolean, java.lang.String, java.lang.String, java.lang.String, boolean, boolean)
 
 - 
getListedTermCountsprotected org.apache.solr.common.util.NamedList<Integer> getListedTermCounts(String field, SimpleFacets.ParsedParams parsed, List<String> terms) throws IOException Computes the term->count counts for the specified term values relative to the- Parameters:
- field- the name of the field to compute term counts against
- parsed- contains the docset to compute term counts relative to
- terms- a list of term values (in the specified field) to compute the counts for
- Throws:
- IOException
 
 - 
getFieldMissingCountpublic static int getFieldMissingCount(SolrIndexSearcher searcher, DocSet docs, String fieldName) throws IOException Returns a count of the documents in the set which do not have any terms for for the specified field.- Throws:
- IOException
- See Also:
- FacetParams.FACET_MISSING
 
 - 
getFacetTermEnumCountspublic org.apache.solr.common.util.NamedList<Integer> getFacetTermEnumCounts(SolrIndexSearcher searcher, DocSet docs, String field, int offset, int limit, int mincount, boolean missing, String sort, String prefix, String contains, boolean ignoreCase, boolean intersectsCheck) throws IOException Works likegetFacetTermEnumCounts(SolrIndexSearcher, DocSet, String, int, int, int, boolean, String, String, Predicate, boolean)but takes a substring directly for the contains check rather than aPredicateinstance.- Throws:
- IOException
 
 - 
getFacetTermEnumCountspublic org.apache.solr.common.util.NamedList<Integer> getFacetTermEnumCounts(SolrIndexSearcher searcher, DocSet docs, String field, int offset, int limit, int mincount, boolean missing, String sort, String prefix, Predicate<org.apache.lucene.util.BytesRef> termFilter, boolean intersectsCheck) throws IOException Returns a list of terms in the specified field along with the corresponding count of documents in the set that match that constraint. This method uses the FilterCache to get the intersection count betweendocsand the DocSet for each term in the filter.- Throws:
- IOException
- See Also:
- FacetParams.FACET_LIMIT,- FacetParams.FACET_ZEROS,- FacetParams.FACET_MISSING
 
 - 
checkMincountOnExistspublic static void checkMincountOnExists(String fieldName, int mincount) 
 - 
getFacetIntervalCountspublic org.apache.solr.common.util.NamedList<Object> getFacetIntervalCounts() throws IOException, SyntaxError Returns aNamedListwith each entry having the "key" of the interval as name and the count of docs in that interval as value. All intervals added in the request are included in the returnedNamedList(included those with 0 count), and it's required that the order of the intervals is deterministic and equals in all shards of a distributed request, otherwise the collation of results will fail.- Throws:
- IOException
- SyntaxError
 
 - 
getHeatmapCountspublic org.apache.solr.common.util.NamedList<Object> getHeatmapCounts() throws IOException, SyntaxError - Throws:
- IOException
- SyntaxError
 
 - 
getGlobalParamspublic org.apache.solr.common.params.SolrParams getGlobalParams() 
 - 
getDocsOrigpublic DocSet getDocsOrig() 
 - 
getRequestpublic SolrQueryRequest getRequest() 
 - 
getResponseBuilderpublic ResponseBuilder getResponseBuilder() 
 
- 
 
-