public class SimpleFacets
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SimpleFacets.CountPair<K extends java.lang.Comparable<? super K>,V extends java.lang.Comparable<? super V>>
A simple key=>val pair whose natural order is such that
higher vals come before lower vals.
|
private static class |
SimpleFacets.DateRangeEndpointCalculator |
private static class |
SimpleFacets.DoubleRangeEndpointCalculator |
private static class |
SimpleFacets.FloatRangeEndpointCalculator |
private static class |
SimpleFacets.IntegerRangeEndpointCalculator |
private static class |
SimpleFacets.LongRangeEndpointCalculator |
private static class |
SimpleFacets.RangeEndpointCalculator<T extends java.lang.Comparable<T>>
Perhaps someday instead of having a giant "instanceof" case
statement to pick an impl, we can add a "RangeFacetable" marker
interface to FieldTypes and they can return instances of these
directly from some method -- but until then, keep this locked down
and private.
|
Modifier and Type | Field and Description |
---|---|
(package private) DocSet |
base |
protected DocSet |
docs
The main set of documents all facet counts should be relative to
|
protected SimpleOrderedMap |
facetResponse |
(package private) java.lang.String |
facetValue |
(package private) java.lang.String |
key |
(package private) SolrParams |
localParams |
private static java.util.Comparator |
nullStrComparator |
protected SolrParams |
params
Configuration params behavior should be driven by
|
protected ResponseBuilder |
rb |
protected SolrQueryRequest |
req |
protected SolrParams |
required |
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 |
---|---|
NamedList |
getFacetCounts()
Looks at various Params to determing if any simple Facet Constraint count
computations are desired.
|
NamedList |
getFacetDateCounts()
Deprecated.
Use getFacetRangeCounts which is more generalized
|
void |
getFacetDateCounts(java.lang.String dateFacet,
NamedList resOuter)
Deprecated.
Use getFacetRangeCounts which is more generalized
|
NamedList |
getFacetFieldCounts()
Returns a list of value constraints and the associated facet counts
for each facet field specified in the params.
|
NamedList |
getFacetQueryCounts()
Returns a list of facet counts for each of the facet queries
specified in the params
|
NamedList |
getFacetRangeCounts()
Returns a list of value constraints and the associated facet
counts for each facet numerical field, range, and interval
specified in the SolrParams
|
private <T extends java.lang.Comparable<T>> |
getFacetRangeCounts(SchemaField sf,
SimpleFacets.RangeEndpointCalculator<T> calc) |
(package private) void |
getFacetRangeCounts(java.lang.String facetRange,
NamedList resOuter) |
NamedList |
getFacetTermEnumCounts(SolrIndexSearcher searcher,
DocSet docs,
java.lang.String field,
int offset,
int limit,
int mincount,
boolean missing,
java.lang.String sort,
java.lang.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 NamedList |
getFieldCacheCounts(SolrIndexSearcher searcher,
DocSet docs,
java.lang.String fieldName,
int offset,
int limit,
int mincount,
boolean missing,
java.lang.String sort,
java.lang.String prefix)
Use the Lucene FieldCache to get counts for each unique field value in
docs . |
static int |
getFieldMissingCount(SolrIndexSearcher searcher,
DocSet docs,
java.lang.String fieldName)
Returns a count of the documents in the set which do not have any
terms for for the specified field.
|
private NamedList |
getListedTermCounts(java.lang.String field,
java.lang.String termList) |
NamedList |
getTermCounts(java.lang.String field) |
(package private) void |
parseParams(java.lang.String type,
java.lang.String param) |
protected int |
rangeCount(SchemaField sf,
java.util.Date low,
java.util.Date high,
boolean iLow,
boolean iHigh)
Deprecated.
Use rangeCount(SchemaField,String,String,boolean,boolean) which is more generalized
|
protected int |
rangeCount(SchemaField sf,
java.lang.String low,
java.lang.String high,
boolean iLow,
boolean iHigh)
Macro for getting the numDocs of range over docs
|
protected DocSet docs
protected SolrParams params
protected SolrParams required
protected SolrIndexSearcher searcher
protected SolrQueryRequest req
protected ResponseBuilder rb
protected SimpleOrderedMap facetResponse
SolrParams localParams
java.lang.String facetValue
DocSet base
java.lang.String key
private static final java.util.Comparator nullStrComparator
public SimpleFacets(SolrQueryRequest req, DocSet docs, SolrParams params)
public SimpleFacets(SolrQueryRequest req, DocSet docs, SolrParams params, ResponseBuilder rb)
void parseParams(java.lang.String type, java.lang.String param) throws org.apache.lucene.queryParser.ParseException, java.io.IOException
org.apache.lucene.queryParser.ParseException
java.io.IOException
public NamedList getFacetCounts()
getFacetQueryCounts()
,
getFacetFieldCounts()
,
getFacetDateCounts()
,
getFacetRangeCounts()
,
FacetParams.FACET
public NamedList getFacetQueryCounts() throws java.io.IOException, org.apache.lucene.queryParser.ParseException
java.io.IOException
org.apache.lucene.queryParser.ParseException
FacetParams.FACET_QUERY
public NamedList getTermCounts(java.lang.String field) throws java.io.IOException
java.io.IOException
public NamedList getFacetFieldCounts() throws java.io.IOException, org.apache.lucene.queryParser.ParseException
java.io.IOException
org.apache.lucene.queryParser.ParseException
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)
private NamedList getListedTermCounts(java.lang.String field, java.lang.String termList) throws java.io.IOException
java.io.IOException
public static int getFieldMissingCount(SolrIndexSearcher searcher, DocSet docs, java.lang.String fieldName) throws java.io.IOException
java.io.IOException
FacetParams.FACET_MISSING
public static NamedList getFieldCacheCounts(SolrIndexSearcher searcher, DocSet docs, java.lang.String fieldName, int offset, int limit, int mincount, boolean missing, java.lang.String sort, java.lang.String prefix) throws java.io.IOException
docs
.
The field must have at most one indexed token per document.java.io.IOException
public NamedList getFacetTermEnumCounts(SolrIndexSearcher searcher, DocSet docs, java.lang.String field, int offset, int limit, int mincount, boolean missing, java.lang.String sort, java.lang.String prefix) throws java.io.IOException
docs
and the DocSet for each term in the filter.java.io.IOException
FacetParams.FACET_LIMIT
,
FacetParams.FACET_ZEROS
,
FacetParams.FACET_MISSING
@Deprecated public NamedList getFacetDateCounts() throws java.io.IOException, org.apache.lucene.queryParser.ParseException
java.io.IOException
org.apache.lucene.queryParser.ParseException
FacetParams.FACET_DATE
@Deprecated public void getFacetDateCounts(java.lang.String dateFacet, NamedList resOuter) throws java.io.IOException, org.apache.lucene.queryParser.ParseException
java.io.IOException
org.apache.lucene.queryParser.ParseException
public NamedList getFacetRangeCounts() throws java.io.IOException, org.apache.lucene.queryParser.ParseException
java.io.IOException
org.apache.lucene.queryParser.ParseException
FacetParams.FACET_RANGE
void getFacetRangeCounts(java.lang.String facetRange, NamedList resOuter) throws java.io.IOException, org.apache.lucene.queryParser.ParseException
java.io.IOException
org.apache.lucene.queryParser.ParseException
private <T extends java.lang.Comparable<T>> NamedList getFacetRangeCounts(SchemaField sf, SimpleFacets.RangeEndpointCalculator<T> calc) throws java.io.IOException
java.io.IOException
protected int rangeCount(SchemaField sf, java.lang.String low, java.lang.String high, boolean iLow, boolean iHigh) throws java.io.IOException
java.io.IOException
SolrIndexSearcher.numDocs(org.apache.lucene.search.Query, org.apache.solr.search.DocSet)
,
TermRangeQuery
@Deprecated protected int rangeCount(SchemaField sf, java.util.Date low, java.util.Date high, boolean iLow, boolean iHigh) throws java.io.IOException
java.io.IOException