public class Grouping
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
Grouping.Command<GROUP_VALUE_TYPE>
General group command.
|
class |
Grouping.CommandField
A group command for grouping on a field.
|
class |
Grouping.CommandQuery
A group command for grouping on a query.
|
static class |
Grouping.Format |
static class |
Grouping.TotalCount |
Modifier and Type | Field and Description |
---|---|
private boolean |
cacheSecondPassSearch |
private SolrIndexSearcher.QueryCommand |
cmd |
private java.util.List<Grouping.Command> |
commands |
private Grouping.Format |
defaultFormat |
private Grouping.TotalCount |
defaultTotalCount |
private int |
docsPerGroupDefault |
private DocSet |
filter |
private boolean |
getDocList |
private boolean |
getDocSet |
private boolean |
getGroupedDocSet |
private NamedList |
grouped |
private int |
groupOffsetDefault |
private org.apache.lucene.search.Sort |
groupSort |
private java.util.Set<java.lang.Integer> |
idSet |
private int |
limitDefault |
private static org.slf4j.Logger |
logger |
private org.apache.lucene.search.Filter |
luceneFilter |
private boolean |
main |
DocList |
mainResult |
private int |
maxDoc |
private int |
maxDocsPercentageToCache |
private int |
maxMatches |
private float |
maxScore |
private boolean |
needScores |
private SolrIndexSearcher.QueryResult |
qr |
private org.apache.lucene.search.Query |
query |
private SolrIndexSearcher |
searcher |
private boolean |
signalCacheWarning |
private org.apache.lucene.search.Sort |
sort |
private org.apache.lucene.search.TimeLimitingCollector |
timeLimitingCollector |
Constructor and Description |
---|
Grouping(SolrIndexSearcher searcher,
SolrIndexSearcher.QueryResult qr,
SolrIndexSearcher.QueryCommand cmd,
boolean cacheSecondPassSearch,
int maxDocsPercentageToCache,
boolean main) |
Modifier and Type | Method and Description |
---|---|
void |
add(Grouping.Command groupingCommand) |
void |
addFieldCommand(java.lang.String field,
SolrQueryRequest request)
Adds a field command based on the specified field.
|
void |
addQueryCommand(java.lang.String groupByStr,
SolrQueryRequest request) |
void |
execute() |
java.util.List<Grouping.Command> |
getCommands() |
(package private) int |
getMax(int offset,
int len,
int max)
Returns offset + len if len equals zero or higher.
|
boolean |
isSignalCacheWarning()
Returns whether a cache warning should be send to the client.
|
private void |
searchWithTimeLimiter(org.apache.lucene.search.Filter luceneFilter,
org.apache.lucene.search.Collector collector)
Invokes search with the specified filter and collector.
|
Grouping |
setDefaultFormat(Grouping.Format defaultFormat) |
Grouping |
setDefaultTotalCount(Grouping.TotalCount defaultTotalCount) |
Grouping |
setDocsPerGroupDefault(int docsPerGroupDefault) |
Grouping |
setGetGroupedDocSet(boolean getGroupedDocSet) |
Grouping |
setGroupOffsetDefault(int groupOffsetDefault) |
Grouping |
setGroupSort(org.apache.lucene.search.Sort groupSort) |
Grouping |
setLimitDefault(int limitDefault) |
Grouping |
setSort(org.apache.lucene.search.Sort sort) |
private static final org.slf4j.Logger logger
private final SolrIndexSearcher searcher
private final SolrIndexSearcher.QueryResult qr
private final SolrIndexSearcher.QueryCommand cmd
private final java.util.List<Grouping.Command> commands
private final boolean main
private final boolean cacheSecondPassSearch
private final int maxDocsPercentageToCache
private org.apache.lucene.search.Sort sort
private org.apache.lucene.search.Sort groupSort
private int limitDefault
private int docsPerGroupDefault
private int groupOffsetDefault
private Grouping.Format defaultFormat
private Grouping.TotalCount defaultTotalCount
private int maxDoc
private boolean needScores
private boolean getDocSet
private boolean getGroupedDocSet
private boolean getDocList
private org.apache.lucene.search.Query query
private DocSet filter
private org.apache.lucene.search.Filter luceneFilter
private NamedList grouped
private java.util.Set<java.lang.Integer> idSet
private int maxMatches
private float maxScore
private boolean signalCacheWarning
private org.apache.lucene.search.TimeLimitingCollector timeLimitingCollector
public DocList mainResult
public Grouping(SolrIndexSearcher searcher, SolrIndexSearcher.QueryResult qr, SolrIndexSearcher.QueryCommand cmd, boolean cacheSecondPassSearch, int maxDocsPercentageToCache, boolean main)
searcher
- qr
- cmd
- cacheSecondPassSearch
- Whether to cache the documents and scores from the first pass search for the second
pass search.maxDocsPercentageToCache
- The maximum number of documents in a percentage relative from maxdoc
that is allowed in the cache. When this threshold is met,
the cache is not used in the second pass search.public void add(Grouping.Command groupingCommand)
public void addFieldCommand(java.lang.String field, SolrQueryRequest request) throws org.apache.lucene.queryParser.ParseException
field
- The fieldname to group by.org.apache.lucene.queryParser.ParseException
public void addQueryCommand(java.lang.String groupByStr, SolrQueryRequest request) throws org.apache.lucene.queryParser.ParseException
org.apache.lucene.queryParser.ParseException
public Grouping setSort(org.apache.lucene.search.Sort sort)
public Grouping setGroupSort(org.apache.lucene.search.Sort groupSort)
public Grouping setLimitDefault(int limitDefault)
public Grouping setDocsPerGroupDefault(int docsPerGroupDefault)
public Grouping setGroupOffsetDefault(int groupOffsetDefault)
public Grouping setDefaultFormat(Grouping.Format defaultFormat)
public Grouping setDefaultTotalCount(Grouping.TotalCount defaultTotalCount)
public Grouping setGetGroupedDocSet(boolean getGroupedDocSet)
public java.util.List<Grouping.Command> getCommands()
public void execute() throws java.io.IOException
java.io.IOException
private void searchWithTimeLimiter(org.apache.lucene.search.Filter luceneFilter, org.apache.lucene.search.Collector collector) throws java.io.IOException
java.io.IOException
int getMax(int offset, int len, int max)
offset
- The offsetlen
- The number of documents to returnmax
- The number of document to return if len < 0 or if offset + len < 0public boolean isSignalCacheWarning()
true
is returned when the cache is emptied because the caching limits where met, otherwise
false
is returned.