Package com.yahoo.search.grouping
Class GroupingRequest
- java.lang.Object
-
- com.yahoo.search.grouping.GroupingRequest
-
public class GroupingRequest extends java.lang.Object
An instance of this class represents one of many grouping requests that are attached to aQuery
. Use the factory methodnewInstance(com.yahoo.search.Query)
to create a new instance of this, then create and set theGroupingOperation
usingsetRootOperation(GroupingOperation)
. Once the search returns, access the resultGroup
using thegetResultGroup(Result)
method.- Author:
- Simon Thoresen Hult, bratseth
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Continuation>
continuations()
Returns the list ofContinuation
s of this request.GroupingRequest
copy(Select parentOfCopy)
Returns a deep copy of thisint
getRequestId()
Returns the id of this GroupingRequest.RootGroup
getResultGroup(Result result)
Returns the root resultRootGroup
that corresponds to this request.GroupingOperation
getRootOperation()
Returns the rootGroupingOperation
that defines this request.java.util.TimeZone
getTimeZone()
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() listGroupingRequest
setRootOperation(GroupingOperation root)
Sets the rootGroupingOperation
that defines this request.GroupingRequest
setTimeZone(java.util.TimeZone timeZone)
Sets theTimeZone
used when resolving time expressions such asDayOfMonthFunction
andHourOfDayFunction
.java.lang.String
toString()
-
-
-
Method Detail
-
copy
public GroupingRequest copy(Select parentOfCopy)
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
public GroupingOperation getRootOperation()
Returns the rootGroupingOperation
that defines this request. As long as this remains unset, the request is void.- Returns:
- the root operation.
-
setRootOperation
public GroupingRequest setRootOperation(GroupingOperation root)
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
public java.util.TimeZone getTimeZone()
Returns theTimeZone
used when resolving time expressions such asDayOfMonthFunction
andHourOfDayFunction
.- Returns:
- the time zone in use.
-
setTimeZone
public GroupingRequest setTimeZone(java.util.TimeZone timeZone)
Sets theTimeZone
used when resolving time expressions such asDayOfMonthFunction
andHourOfDayFunction
.- Parameters:
timeZone
- the time zone to set.- Returns:
- this, to allow chaining.
-
getResultGroup
public RootGroup getResultGroup(Result result)
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
public java.util.List<Continuation> 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.
-
newInstance
public static GroupingRequest newInstance(Query query)
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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-