Package org.apache.solr.search
Class Grouping.Command<T>
java.lang.Object
org.apache.solr.search.Grouping.Command<T>
- Direct Known Subclasses:
Grouping.CommandField,Grouping.CommandFunc,Grouping.CommandQuery
- Enclosing class:
Grouping
General group command. A group command is responsible for creating the first and second pass
collectors. A group command is also responsible for creating the response structure.
Note: Maybe the creating the response structure should be done in something like a ReponseBuilder??? Warning NOT thread save!
-
Field Summary
FieldsModifier and TypeFieldDescriptionintintorg.apache.lucene.search.Sortbooleanintintorg.apache.lucene.search.Sort -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddDocList(org.apache.solr.common.util.NamedList<? super DocList> rsp, org.apache.lucene.search.grouping.GroupDocs<?> groups) protected org.apache.solr.common.util.NamedList<Object> org.apache.lucene.search.grouping.AllGroupHeadsCollector<?> Returns a collector that is able to return the most relevant document of all groups.protected abstract org.apache.lucene.search.CollectorReturns one or moreCollectorinstances that are needed to perform the first pass search.protected org.apache.lucene.search.CollectorReturns zero or moreCollectorinstances that are needed to perform the second pass search.protected DocListprotected abstract voidfinish()Performs any necessary post actions to prepare the response.protected DocListgetDocList(org.apache.lucene.search.grouping.GroupDocs<?> groups) abstract intReturns the number of matches for thisCommand.protected IntegerReturns the number of groups found for thisCommand.protected voidprotected abstract voidprepare()Prepare thisCommandfor execution.
-
Field Details
-
key
-
withinGroupSort
public org.apache.lucene.search.Sort withinGroupSort -
groupSort
public org.apache.lucene.search.Sort groupSort -
docsPerGroup
public int docsPerGroup -
groupOffset
public int groupOffset -
numGroups
public int numGroups -
offset
public int offset -
format
-
main
public boolean main -
totalCount
-
-
Constructor Details
-
Command
public Command()
-
-
Method Details
-
prepare
Prepare thisCommandfor execution.- Throws:
IOException- If I/O related errors occur
-
createFirstPassCollector
Returns one or moreCollectorinstances that are needed to perform the first pass search. If multiple Collectors are returned then these wrapped in aMultiCollector.- Returns:
- one or more
Collectorinstances that are need to perform the first pass search - Throws:
IOException- If I/O related errors occur
-
createSecondPassCollector
Returns zero or moreCollectorinstances that are needed to perform the second pass search. In the case when noCollectorinstances are creatednullis returned. If multiple Collectors are returned then these wrapped in aMultiCollector.- Returns:
- zero or more
Collectorinstances that are needed to perform the second pass search - Throws:
IOException- If I/O related errors occur
-
createAllGroupCollector
public org.apache.lucene.search.grouping.AllGroupHeadsCollector<?> createAllGroupCollector() throws IOExceptionReturns a collector that is able to return the most relevant document of all groups. Returnsnullif the command doesn't support this type of collector.- Returns:
- a collector that is able to return the most relevant document of all groups.
- Throws:
IOException- If I/O related errors occur
-
finish
Performs any necessary post actions to prepare the response.- Throws:
IOException- If I/O related errors occur
-
getMatches
public abstract int getMatches()Returns the number of matches for thisCommand.- Returns:
- the number of matches for this
Command
-
getNumberOfGroups
Returns the number of groups found for thisCommand. If the command doesn't support counting the groupsnullis returned.- Returns:
- the number of groups found for this
Command
-
populateScoresIfNecessary
- Throws:
IOException
-
commonResponse
-
getDocList
-
addDocList
protected void addDocList(org.apache.solr.common.util.NamedList<? super DocList> rsp, org.apache.lucene.search.grouping.GroupDocs<?> groups) -
createSimpleResponse
-