public class SimpleFacets extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SimpleFacets.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 class |
SimpleFacets.ParsedParams |
Modifier and Type | Field and Description |
---|---|
protected DocSet |
docsOrig
The main set of documents all facet counts should be relative to
|
protected FacetDebugInfo |
fdebug |
protected FacetDebugInfo |
fdebugParent |
protected SolrParams |
global
Configuration params behavior should be driven by
|
protected ResponseBuilder |
rb |
protected SolrQueryRequest |
req |
protected SolrIndexSearcher |
searcher
Searcher to use for all calculations
|
Constructor and Description |
---|
SimpleFacets(SolrQueryRequest req,
DocSet docs,
SolrParams params) |
SimpleFacets(SolrQueryRequest req,
DocSet docs,
SolrParams params,
ResponseBuilder rb) |
Modifier and Type | Method and Description |
---|---|
static void |
checkMincountOnExists(String fieldName,
int mincount) |
protected DocSet |
computeDocSet(DocSet baseDocSet,
List<String> excludeTagList) |
DocSet |
getDocsOrig() |
NamedList<Object> |
getFacetFieldCounts()
Returns a list of value constraints and the associated facet counts
for each facet field specified in the params.
|
NamedList<Object> |
getFacetIntervalCounts()
Returns a
NamedList with each entry having the "key" of the interval as name and the count of docs
in that interval as value. |
void |
getFacetQueryCount(SimpleFacets.ParsedParams parsed,
NamedList<Integer> res) |
NamedList<Integer> |
getFacetQueryCounts()
Returns a list of facet counts for each of the facet queries
specified in the params
|
NamedList<Integer> |
getFacetTermEnumCounts(SolrIndexSearcher searcher,
DocSet docs,
String field,
int offset,
int limit,
int mincount,
boolean missing,
String sort,
String prefix,
Predicate<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.
|
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 like
getFacetTermEnumCounts(SolrIndexSearcher, DocSet, String, int, int, int, boolean, String, String, Predicate, boolean)
but takes a substring directly for the contains check rather than a Predicate instance. |
static int |
getFieldMissingCount(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.
|
SolrParams |
getGlobalParams() |
NamedList<Integer> |
getGroupedCounts(SolrIndexSearcher searcher,
DocSet base,
String field,
boolean multiToken,
int offset,
int limit,
int mincount,
boolean missing,
String sort,
String prefix,
Predicate<BytesRef> termFilter) |
int |
getGroupedFacetQueryCount(Query facetQuery,
DocSet docSet)
Returns a grouped facet count for the facet query
|
NamedList |
getHeatmapCounts() |
protected NamedList<Integer> |
getListedTermCounts(String field,
SimpleFacets.ParsedParams parsed,
List<String> terms)
Computes the term->count counts for the specified term values relative to the
|
SolrQueryRequest |
getRequest() |
ResponseBuilder |
getResponseBuilder() |
NamedList<Integer> |
getTermCounts(String field,
SimpleFacets.ParsedParams parsed)
Term counts for use in field faceting that resepects the appropriate mincount
|
NamedList<Integer> |
getTermCountsForPivots(String field,
SimpleFacets.ParsedParams parsed)
Term counts for use in pivot faceting that resepcts the appropriate mincount
|
protected Predicate<BytesRef> |
newBytesRefFilter(String field,
SolrParams params)
Create a new bytes ref filter for filtering facet terms.
|
protected Predicate<BytesRef> |
newExcludeBytesRefFilter(String field,
SolrParams params)
Create a new bytes ref filter for excluding facet terms.
|
protected SimpleFacets.ParsedParams |
parseParams(String type,
String param) |
void |
setFacetDebugInfo(FacetDebugInfo fdebugParent) |
protected DocSet docsOrig
protected final SolrParams global
protected final SolrIndexSearcher searcher
protected final SolrQueryRequest req
protected final ResponseBuilder rb
protected FacetDebugInfo fdebugParent
protected FacetDebugInfo fdebug
public SimpleFacets(SolrQueryRequest req, DocSet docs, SolrParams params)
public SimpleFacets(SolrQueryRequest req, DocSet docs, SolrParams params, ResponseBuilder rb)
public void setFacetDebugInfo(FacetDebugInfo fdebugParent)
protected SimpleFacets.ParsedParams parseParams(String type, String param) throws SyntaxError, IOException
SyntaxError
IOException
protected DocSet computeDocSet(DocSet baseDocSet, List<String> excludeTagList) throws SyntaxError, IOException
SyntaxError
IOException
public NamedList<Integer> getFacetQueryCounts() throws IOException, SyntaxError
IOException
SyntaxError
FacetParams.FACET_QUERY
public void getFacetQueryCount(SimpleFacets.ParsedParams parsed, NamedList<Integer> res) throws SyntaxError, IOException
SyntaxError
IOException
public int getGroupedFacetQueryCount(Query facetQuery, DocSet docSet) throws IOException
IOException
FacetParams.FACET_QUERY
protected Predicate<BytesRef> newExcludeBytesRefFilter(String field, SolrParams params)
FacetParams.FACET_EXCLUDETERMS
parameter
but custom SimpleFacets classes could use a different implementation.field
- the field to check for facet term filtersparams
- the request parameter objectprotected Predicate<BytesRef> newBytesRefFilter(String field, SolrParams params)
Predicate.and(Predicate)
of all such filters.field
- the field to check for facet term filtersparams
- the request parameter objectpublic NamedList<Integer> getTermCountsForPivots(String field, SimpleFacets.ParsedParams parsed) throws IOException
IOException
FacetParams.FACET_PIVOT_MINCOUNT
public NamedList<Integer> getTermCounts(String field, SimpleFacets.ParsedParams parsed) throws IOException
IOException
FacetParams.FACET_MINCOUNT
public NamedList<Integer> getGroupedCounts(SolrIndexSearcher searcher, DocSet base, String field, boolean multiToken, int offset, int limit, int mincount, boolean missing, String sort, String prefix, Predicate<BytesRef> termFilter) throws IOException
IOException
public NamedList<Object> getFacetFieldCounts() throws IOException, SyntaxError
IOException
SyntaxError
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)
protected NamedList<Integer> getListedTermCounts(String field, SimpleFacets.ParsedParams parsed, List<String> terms) throws IOException
field
- the name of the field to compute term counts againstparsed
- contains the docset to compute term counts relative toterms
- a list of term values (in the specified field) to compute the counts forIOException
public static int getFieldMissingCount(SolrIndexSearcher searcher, DocSet docs, String fieldName) throws IOException
IOException
FacetParams.FACET_MISSING
public 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
getFacetTermEnumCounts(SolrIndexSearcher, DocSet, String, int, int, int, boolean, String, String, Predicate, boolean)
but takes a substring directly for the contains check rather than a Predicate
instance.IOException
public NamedList<Integer> getFacetTermEnumCounts(SolrIndexSearcher searcher, DocSet docs, String field, int offset, int limit, int mincount, boolean missing, String sort, String prefix, Predicate<BytesRef> termFilter, boolean intersectsCheck) throws IOException
docs
and the DocSet for each term in the filter.IOException
FacetParams.FACET_LIMIT
,
FacetParams.FACET_ZEROS
,
FacetParams.FACET_MISSING
public static void checkMincountOnExists(String fieldName, int mincount)
public NamedList<Object> getFacetIntervalCounts() throws IOException, SyntaxError
NamedList
with 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 returned
NamedList
(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.IOException
SyntaxError
public NamedList getHeatmapCounts() throws IOException, SyntaxError
IOException
SyntaxError
public SolrParams getGlobalParams()
public DocSet getDocsOrig()
public SolrQueryRequest getRequest()
public ResponseBuilder getResponseBuilder()
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.