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.
|
Modifier and Type | Field and Description |
---|---|
protected DocSet |
docs |
protected DocSet |
docsOrig
The main set of documents all facet counts should be relative to
|
protected SimpleOrderedMap<Object> |
facetResponse |
protected String |
facetValue |
protected String |
key |
protected SolrParams |
localParams |
protected SolrParams |
orig
Configuration params behavior should be driven by
|
protected SolrParams |
params |
protected ResponseBuilder |
rb |
protected SolrQueryRequest |
req |
protected SolrParams |
required |
protected SolrIndexSearcher |
searcher
Searcher to use for all calculations
|
protected int |
threads |
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 |
---|---|
NamedList<Object> |
getFacetCounts()
Looks at various Params to determining if any simple Facet Constraint count
computations are desired.
|
NamedList<Object> |
getFacetDateCounts()
Deprecated.
Use getFacetRangeCounts which is more generalized
|
void |
getFacetDateCounts(String dateFacet,
NamedList<Object> resOuter)
Deprecated.
Use getFacetRangeCounts which is more generalized
|
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. |
NamedList<Integer> |
getFacetQueryCounts()
Returns a list of facet counts for each of the facet queries
specified in the params
|
NamedList<Object> |
getFacetRangeCounts()
Returns a list of value constraints and the associated facet
counts for each facet numerical field, range, and interval
specified in the SolrParams
|
NamedList<Integer> |
getFacetTermEnumCounts(SolrIndexSearcher searcher,
DocSet docs,
String field,
int offset,
int limit,
int mincount,
boolean missing,
String sort,
String prefix)
Returns a list of terms in the specified field along with the
corresponding count of documents in the set that match that constraint.
|
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.
|
NamedList<Integer> |
getGroupedCounts(SolrIndexSearcher searcher,
DocSet base,
String field,
boolean multiToken,
int offset,
int limit,
int mincount,
boolean missing,
String sort,
String prefix) |
int |
getGroupedFacetQueryCount(Query facetQuery)
Returns a grouped facet count for the facet query
|
protected NamedList<Integer> |
getListedTermCounts(String field,
DocSet base,
List<String> terms)
Computes the term->count counts for the specified term values relative to the
|
NamedList<Integer> |
getTermCounts(String field)
Term counts for use in field faceting that resepects the appropriate mincount
|
NamedList<Integer> |
getTermCounts(String field,
DocSet base)
Term counts for use in field faceting that resepects the appropriate mincount
|
NamedList<Integer> |
getTermCountsForPivots(String field,
DocSet docs)
Term counts for use in pivot faceting that resepcts the appropriate mincount
|
protected void |
parseParams(String type,
String param) |
protected int |
rangeCount(SchemaField sf,
Date low,
Date high,
boolean iLow,
boolean iHigh)
Deprecated.
Use rangeCount(SchemaField,String,String,boolean,boolean) which is more generalized
|
protected int |
rangeCount(SchemaField sf,
String low,
String high,
boolean iLow,
boolean iHigh)
Macro for getting the numDocs of range over docs
|
protected DocSet docsOrig
protected final SolrParams orig
protected final SolrIndexSearcher searcher
protected final SolrQueryRequest req
protected final ResponseBuilder rb
protected SimpleOrderedMap<Object> facetResponse
protected SolrParams localParams
protected SolrParams params
protected SolrParams required
protected String facetValue
protected DocSet docs
protected String key
protected int threads
public SimpleFacets(SolrQueryRequest req, DocSet docs, SolrParams params)
public SimpleFacets(SolrQueryRequest req, DocSet docs, SolrParams params, ResponseBuilder rb)
protected void parseParams(String type, String param) throws SyntaxError, IOException
SyntaxError
IOException
public NamedList<Object> getFacetCounts()
getFacetQueryCounts()
,
getFacetFieldCounts()
,
getFacetDateCounts()
,
getFacetRangeCounts()
,
getFacetIntervalCounts()
,
FacetParams.FACET
public NamedList<Integer> getFacetQueryCounts() throws IOException, SyntaxError
IOException
SyntaxError
FacetParams.FACET_QUERY
public int getGroupedFacetQueryCount(Query facetQuery) throws IOException
IOException
FacetParams.FACET_QUERY
public NamedList<Integer> getTermCountsForPivots(String field, DocSet docs) throws IOException
IOException
FacetParams.FACET_PIVOT_MINCOUNT
public NamedList<Integer> getTermCounts(String field) throws IOException
IOException
FacetParams.FACET_MINCOUNT
public NamedList<Integer> getTermCounts(String field, DocSet base) 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) 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)
protected NamedList<Integer> getListedTermCounts(String field, DocSet base, List<String> terms) throws IOException
field
- the name of the field to compute term counts againstbase
- 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) throws IOException
docs
and the DocSet for each term in the filter.IOException
FacetParams.FACET_LIMIT
,
FacetParams.FACET_ZEROS
,
FacetParams.FACET_MISSING
@Deprecated public NamedList<Object> getFacetDateCounts() throws IOException, SyntaxError
IOException
SyntaxError
FacetParams.FACET_DATE
@Deprecated public void getFacetDateCounts(String dateFacet, NamedList<Object> resOuter) throws IOException, SyntaxError
IOException
SyntaxError
public NamedList<Object> getFacetRangeCounts() throws IOException, SyntaxError
IOException
SyntaxError
FacetParams.FACET_RANGE
protected int rangeCount(SchemaField sf, String low, String high, boolean iLow, boolean iHigh) throws IOException
@Deprecated protected int rangeCount(SchemaField sf, Date low, Date high, boolean iLow, boolean iHigh) throws IOException
IOException
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
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.