Package org.apache.solr.search
Class Grouping
- java.lang.Object
- 
- org.apache.solr.search.Grouping
 
- 
 public class Grouping extends Object Basic Solr Grouping infrastructure. Warning NOT thread safe!- WARNING: This API is experimental and might change in incompatible ways in the next release.
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classGrouping.Command<T>General group command.classGrouping.CommandFieldA group command for grouping on a field.classGrouping.CommandFuncA command for grouping on a function.classGrouping.CommandQueryA group command for grouping on a query.static classGrouping.Formatstatic classGrouping.TotalCount
 - 
Field SummaryFields Modifier and Type Field Description DocListmainResult
 - 
Constructor SummaryConstructors Constructor Description Grouping(SolrIndexSearcher searcher, QueryResult qr, QueryCommand cmd, boolean cacheSecondPassSearch, int maxDocsPercentageToCache, boolean main)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Grouping.Command<?> groupingCommand)voidaddFieldCommand(String field, SolrQueryRequest request)Adds a field command based on the specified field.voidaddFunctionCommand(String groupByStr, SolrQueryRequest request)voidaddQueryCommand(String groupByStr, SolrQueryRequest request)voidexecute()List<Grouping.Command<?>>getCommands()static intgetMax(int offset, int len, int max)Returns offset + len if len equals zero or higher.booleanisSignalCacheWarning()Returns whether a cache warning should be send to the client.GroupingsetDefaultFormat(Grouping.Format defaultFormat)GroupingsetDefaultTotalCount(Grouping.TotalCount defaultTotalCount)GroupingsetDocsPerGroupDefault(int docsPerGroupDefault)GroupingsetGetGroupedDocSet(boolean getGroupedDocSet)GroupingsetGroupOffsetDefault(int groupOffsetDefault)GroupingsetGroupSort(org.apache.lucene.search.Sort groupSort)GroupingsetLimitDefault(int limitDefault)GroupingsetWithinGroupSort(org.apache.lucene.search.Sort withinGroupSort)
 
- 
- 
- 
Field Detail- 
mainResultpublic DocList mainResult 
 
- 
 - 
Constructor Detail- 
Groupingpublic Grouping(SolrIndexSearcher searcher, QueryResult qr, QueryCommand cmd, boolean cacheSecondPassSearch, int maxDocsPercentageToCache, boolean main) - Parameters:
- 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.
 
 
- 
 - 
Method Detail- 
addpublic void add(Grouping.Command<?> groupingCommand) 
 - 
addFieldCommandpublic void addFieldCommand(String field, SolrQueryRequest request) throws SyntaxError Adds a field command based on the specified field. If the field is not compatible withGrouping.CommandFieldit invokes theaddFunctionCommand(String, org.apache.solr.request.SolrQueryRequest)method.- Parameters:
- field- The fieldname to group by.
- Throws:
- SyntaxError
 
 - 
addFunctionCommandpublic void addFunctionCommand(String groupByStr, SolrQueryRequest request) throws SyntaxError - Throws:
- SyntaxError
 
 - 
addQueryCommandpublic void addQueryCommand(String groupByStr, SolrQueryRequest request) throws SyntaxError - Throws:
- SyntaxError
 
 - 
setGroupSortpublic Grouping setGroupSort(org.apache.lucene.search.Sort groupSort) 
 - 
setWithinGroupSortpublic Grouping setWithinGroupSort(org.apache.lucene.search.Sort withinGroupSort) 
 - 
setLimitDefaultpublic Grouping setLimitDefault(int limitDefault) 
 - 
setDocsPerGroupDefaultpublic Grouping setDocsPerGroupDefault(int docsPerGroupDefault) 
 - 
setGroupOffsetDefaultpublic Grouping setGroupOffsetDefault(int groupOffsetDefault) 
 - 
setDefaultFormatpublic Grouping setDefaultFormat(Grouping.Format defaultFormat) 
 - 
setDefaultTotalCountpublic Grouping setDefaultTotalCount(Grouping.TotalCount defaultTotalCount) 
 - 
setGetGroupedDocSetpublic Grouping setGetGroupedDocSet(boolean getGroupedDocSet) 
 - 
getCommandspublic List<Grouping.Command<?>> getCommands() 
 - 
executepublic void execute() throws IOException- Throws:
- IOException
 
 - 
getMaxpublic static int getMax(int offset, int len, int max)Returns offset + len if len equals zero or higher. Otherwise returns max.- Parameters:
- offset- The offset
- len- The number of documents to return
- max- The number of document to return if len < 0 or if offset + len > 0
- Returns:
- offset + len if len equals zero or higher. Otherwise returns max
 
 - 
isSignalCacheWarningpublic boolean isSignalCacheWarning() Returns whether a cache warning should be send to the client. The valuetrueis returned when the cache is emptied because the caching limits where met, otherwisefalseis returned.- Returns:
- whether a cache warning should be send to the client
 
 
- 
 
-