Package com.yahoo.search.grouping
Class GroupingRequest
java.lang.Object
com.yahoo.search.grouping.GroupingRequest
An instance of this class represents one of many grouping requests that are attached to a
Query. Use the
factory method newInstance(com.yahoo.search.Query) to create a new instance of this, then create and set the
GroupingOperation using setRootOperation(GroupingOperation). Once the search returns, access the
result Group using the getResultGroup(Result) method.- Author:
- Simon Thoresen Hult, bratseth
-
Method Summary
Modifier and TypeMethodDescriptionReturns the list ofContinuations of this request.Returns a deep copy of thisintReturns the id of this GroupingRequest.getResultGroup(Result result) Returns the root resultRootGroupthat corresponds to this request.Returns the rootGroupingOperationthat defines this request.Returns theTimeZoneused when resolving time expressions such asDayOfMonthFunctionandHourOfDayFunction.static GroupingRequestnewInstance(Query query) Creates a new grouping request and adds it to the query.getSelect().getGrouping() listvoidsetDefaultMaxGroups(int v) voidsetDefaultMaxHits(int v) voidsetGlobalMaxGroups(long v) Sets the rootGroupingOperationthat defines this request.setTimeZone(TimeZone timeZone) Sets theTimeZoneused when resolving time expressions such asDayOfMonthFunctionandHourOfDayFunction.toString()
-
Method Details
-
copy
Returns a deep copy of this -
getRequestId
public int getRequestId()Returns the id of this GroupingRequest. This id is injected into theRootGroupof the final result, and allows tracking of per-request meta data.- Returns:
- the id of this request, or -1 if it has been removed from the query select statement
-
getRootOperation
Returns the rootGroupingOperationthat defines this request. As long as this remains unset, the request is void.- Returns:
- the root operation.
-
setRootOperation
Sets the rootGroupingOperationthat defines this request. As long as this remains unset, the request is void.- Parameters:
root- the root operation to set.- Returns:
- this, to allow chaining.
-
getTimeZone
Returns theTimeZoneused when resolving time expressions such asDayOfMonthFunctionandHourOfDayFunction.- Returns:
- the time zone in use.
-
setTimeZone
Sets theTimeZoneused when resolving time expressions such asDayOfMonthFunctionandHourOfDayFunction.- Parameters:
timeZone- the time zone to set.- Returns:
- this, to allow chaining.
-
getResultGroup
Returns the root resultRootGroupthat corresponds to this request. This is not available until the search returns. Because searchers are allowed to modify bothResultandHitobjects freely, this method requires that you pass it the currentResultobject as argument.- Parameters:
result- the search result that contains the root group.- Returns:
- the result
RootGroupof this request, or null if not found.
-
continuations
Returns the list ofContinuations of this request. This is used by the executing grouping searcher to allow pagination of grouping results.- Returns:
- the list of Continuations.
-
defaultMaxHits
-
setDefaultMaxHits
public void setDefaultMaxHits(int v) -
defaultMaxGroups
-
setDefaultMaxGroups
public void setDefaultMaxGroups(int v) -
globalMaxGroups
-
setGlobalMaxGroups
public void setGlobalMaxGroups(long v) -
defaultPrecisionFactor
-
newInstance
Creates a new grouping request and adds it to the query.getSelect().getGrouping() list- Parameters:
query- the query to attach the request to.- Returns:
- The created request.
-
toString
-