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 ofContinuation
s of this request.Returns a deep copy of thisint
Returns the id of this GroupingRequest.getResultGroup
(Result result) Returns the root resultRootGroup
that corresponds to this request.Returns the rootGroupingOperation
that defines this request.Returns theTimeZone
used when resolving time expressions such asDayOfMonthFunction
andHourOfDayFunction
.static GroupingRequest
newInstance
(Query query) Creates a new grouping request and adds it to the query.getSelect().getGrouping() listvoid
setDefaultMaxGroups
(int v) void
setDefaultMaxHits
(int v) void
setGlobalMaxGroups
(long v) Sets the rootGroupingOperation
that defines this request.setTimeZone
(TimeZone timeZone) Sets theTimeZone
used when resolving time expressions such asDayOfMonthFunction
andHourOfDayFunction
.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 theRootGroup
of 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 rootGroupingOperation
that defines this request. As long as this remains unset, the request is void.- Returns:
- the root operation.
-
setRootOperation
Sets the rootGroupingOperation
that 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 theTimeZone
used when resolving time expressions such asDayOfMonthFunction
andHourOfDayFunction
.- Returns:
- the time zone in use.
-
setTimeZone
Sets theTimeZone
used when resolving time expressions such asDayOfMonthFunction
andHourOfDayFunction
.- Parameters:
timeZone
- the time zone to set.- Returns:
- this, to allow chaining.
-
getResultGroup
Returns the root resultRootGroup
that corresponds to this request. This is not available until the search returns. Because searchers are allowed to modify bothResult
andHit
objects freely, this method requires that you pass it the currentResult
object as argument.- Parameters:
result
- the search result that contains the root group.- Returns:
- the result
RootGroup
of this request, or null if not found.
-
continuations
Returns the list ofContinuation
s 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
-