Package org.apache.solr.search
Class Grouping
java.lang.Object
org.apache.solr.search.Grouping
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 Summary
Nested ClassesModifier and TypeClassDescriptionclassGeneral group command.classA group command for grouping on a field.classA command for grouping on a function.classA group command for grouping on a query.static enumstatic enum -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGrouping(SolrIndexSearcher searcher, QueryResult qr, QueryCommand cmd, boolean cacheSecondPassSearch, int maxDocsPercentageToCache, boolean main) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(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<?>> static intgetMax(int offset, int len, int max) Returns offset + len if len equals zero or higher.booleanReturns whether a cache warning should be send to the client.setDefaultFormat(Grouping.Format defaultFormat) setDefaultTotalCount(Grouping.TotalCount defaultTotalCount) setDocsPerGroupDefault(int docsPerGroupDefault) setGetGroupedDocSet(boolean getGroupedDocSet) setGroupOffsetDefault(int groupOffsetDefault) setGroupSort(org.apache.lucene.search.Sort groupSort) setLimitDefault(int limitDefault) setWithinGroupSort(org.apache.lucene.search.Sort withinGroupSort)
-
Field Details
-
mainResult
-
-
Constructor Details
-
Grouping
public 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 Details
-
add
-
addFieldCommand
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
-
addFunctionCommand
- Throws:
SyntaxError
-
addQueryCommand
- Throws:
SyntaxError
-
setGroupSort
-
setWithinGroupSort
-
setLimitDefault
-
setDocsPerGroupDefault
-
setGroupOffsetDefault
-
setDefaultFormat
-
setDefaultTotalCount
-
setGetGroupedDocSet
-
getCommands
-
execute
- Throws:
IOException
-
getMax
public static int getMax(int offset, int len, int max) Returns offset + len if len equals zero or higher. Otherwise returns max.- Parameters:
offset- The offsetlen- The number of documents to returnmax- 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
-
isSignalCacheWarning
public 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
-