Class AggregateArgs

java.lang.Object
io.quarkus.redis.datasource.search.AggregateArgs
All Implemented Interfaces:
RedisCommandExtraArguments

public class AggregateArgs extends Object implements RedisCommandExtraArguments
Represents the extra arguments of the ft.aggregate command.
  • Constructor Details

    • AggregateArgs

      public AggregateArgs()
  • Method Details

    • verbatim

      public AggregateArgs verbatim()
      If set, does not try to use stemming for query expansion but searches the query terms verbatim.
      Returns:
      the current AggregateArgs
    • allFields

      public AggregateArgs allFields()
      Loads all the document attributes from the source documents.
      Returns:
      the current AggregateArgs
    • field

      public AggregateArgs field(String field, String alias)
      Adds the given attribute to the list of attribute loaded from the document source. You can pass the list of identifier, being either an attribute name for hashes and JSON or a JSON Path expression for JSON. The alias is the optional name used in the result. If it is not provided, the identifier is used. This should be avoided.

      Attributes needed for aggregations should be stored as SORTABLE, where they are available to the aggregation pipeline with very low latency. LOAD hurts the performance of aggregate queries considerably because every processed record needs to execute the equivalent of HMGET against a Redis key, which when executed over millions of keys, amounts to high processing times.

      Parameters:
      field - the field
      alias - the alias (optional but recommended)
      Returns:
      the current AggregateArgs
    • field

      public AggregateArgs field(String field)
      Adds the given attribute to the list of attribute loaded from the document source. You can pass the list of identifier, being either an attribute name for hashes and JSON or a JSON Path expression for JSON.

      Attributes needed for aggregations should be stored as SORTABLE, where they are available to the aggregation pipeline with very low latency. LOAD hurts the performance of aggregate queries considerably because every processed record needs to execute the equivalent of HMGET against a Redis key, which when executed over millions of keys, amounts to high processing times.

      Parameters:
      field - the field
      Returns:
      the current AggregateArgs
    • timeout

      public AggregateArgs timeout(Duration timeout)
      Overrides the timeout parameter of the module.
      Parameters:
      timeout - the timeout
      Returns:
      the current AggregateArgs
    • groupBy

      public AggregateArgs groupBy(AggregateArgs.GroupBy groupBy)
      Groups the results in the pipeline based on one or more properties. Each group should have at least one reducer, a function that handles the group entries, either counting them, or performing multiple aggregate operations.
      Parameters:
      groupBy - the group by clause
      Returns:
      the current AggregateArgs
    • sortBy

      public AggregateArgs sortBy(AggregateArgs.SortBy sortBy)
      Sorts the pipeline up until the point of SORTBY, using the given property and the ascending order.
      Parameters:
      sortBy - the sort by clause
      Returns:
      the current AggregateArgs
    • apply

      public AggregateArgs apply(AggregateArgs.Apply apply)
      Applies a 1-to-1 transformation on one or more properties and either stores the result as a new property down the pipeline or replaces any property using this transformation.

      expression is an expression that can be used to perform arithmetic operations on numeric properties, or functions that can be applied on properties depending on their types, or any combination thereof.

      For example, APPLY "sqrt(@foo)/log(@bar) + 5" AS baz evaluates this expression dynamically for each record in the pipeline and store the result as a new property called baz, which can be referenced by further APPLY/SORTBY/GROUPBY/REDUCE operations down the pipeline.

      Parameters:
      apply - the Apply clause
      Returns:
      the current AggregateArgs
    • limit

      public AggregateArgs limit(int offset, int count)
      Limits the number of results to return just num results starting at index offset (zero-based). It is much more efficient to use SORTBY … MAX if you are interested in just limiting the output of a sort operation.
      Parameters:
      offset - the offset
      count - the count
      Returns:
      the current AggregateArgs
    • filter

      public AggregateArgs filter(String filter)
      Filters the results using predicate expressions relating to values in each result. They are applied post query and relate to the current state of the pipeline.
      Parameters:
      filter - the filter
      Returns:
      the current AggregateArgs
    • param

      public AggregateArgs param(String name, Object value)
      Defines one or more value parameters. Each parameter has a name and a value. You can reference parameters in the query by a $, followed by the parameter name, for example, $user. Each such reference in the search query to a parameter name is substituted by the corresponding parameter value. For example, with parameter definition PARAMS 4 lon 29.69465 lat 34.95126, the expression @loc:[$lon $lat 10 km] is evaluated to @loc:[29.69465 34.95126 10 km]. You cannot reference parameters in the query string where concrete values are not allowed, such as in field names, for example, @loc.

      To use PARAMS, set DIALECT to 2.

      Parameters:
      name - the parameter name
      value - the parameter value
      Returns:
      the current AggregateArgs
    • dialect

      public AggregateArgs dialect(int version)
      Selects the dialect version under which to execute the query. If not specified, the query will execute under the default dialect version set during module initial loading.
      Parameters:
      version - the version
      Returns:
      the current AggregateArgs
    • withCursor

      public AggregateArgs withCursor()
      Scan part of the results with a quicker alternative than LIMIT.
      Returns:
      the current AggregateArgs
    • cursorCount

      public AggregateArgs cursorCount(int count)
      When using a cursor, configure the number of result.
      Parameters:
      count - the number of result to fetch in one go.
      Returns:
      the current AggregateArgs
    • cursorMaxIdleTime

      public AggregateArgs cursorMaxIdleTime(Duration maxIdleDuration)
      When using a cursor, configure the max idle duration.
      Parameters:
      maxIdleDuration - the max idle duration of the cursor.
      Returns:
      the current AggregateArgs
    • toArgs

      public List<Object> toArgs()
      Specified by:
      toArgs in interface RedisCommandExtraArguments
      Returns:
      the list of arguments.
    • hasCursor

      public boolean hasCursor()