Class GroupingRequest

java.lang.Object
com.yahoo.search.grouping.GroupingRequest

public class GroupingRequest extends Object
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 Details

    • 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 the RootGroup 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 root GroupingOperation 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 root GroupingOperation 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 TimeZone getTimeZone()
      Returns the TimeZone used when resolving time expressions such as DayOfMonthFunction and HourOfDayFunction.
      Returns:
      the time zone in use.
    • setTimeZone

      public GroupingRequest setTimeZone(TimeZone timeZone)
      Sets the TimeZone used when resolving time expressions such as DayOfMonthFunction and HourOfDayFunction.
      Parameters:
      timeZone - the time zone to set.
      Returns:
      this, to allow chaining.
    • getResultGroup

      public RootGroup getResultGroup(Result result)
      Returns the root result RootGroup that corresponds to this request. This is not available until the search returns. Because searchers are allowed to modify both Result and Hit objects freely, this method requires that you pass it the current Result 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 List<Continuation> continuations()
      Returns the list of Continuations of this request. This is used by the executing grouping searcher to allow pagination of grouping results.
      Returns:
      the list of Continuations.
    • defaultMaxHits

      public OptionalInt defaultMaxHits()
    • setDefaultMaxHits

      public void setDefaultMaxHits(int v)
    • defaultMaxGroups

      public OptionalInt defaultMaxGroups()
    • setDefaultMaxGroups

      public void setDefaultMaxGroups(int v)
    • globalMaxGroups

      public OptionalLong globalMaxGroups()
    • setGlobalMaxGroups

      public void setGlobalMaxGroups(long v)
    • defaultPrecisionFactor

      public OptionalDouble defaultPrecisionFactor()
    • 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 String toString()
      Overrides:
      toString in class Object