Class QueryArgs

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

public class QueryArgs extends Object implements RedisCommandExtraArguments
Represents the extra arguments of the ft.search command
  • Field Details

    • nocontent

      public boolean nocontent
  • Constructor Details

    • QueryArgs

      public QueryArgs()
  • Method Details

    • nocontent

      public QueryArgs nocontent()
      Returns the document ids and not the content. This is useful if RedisSearch is only an index on an external document collection.
      Returns:
      the current QueryArgs
    • verbatim

      public QueryArgs verbatim()
      Does not try to use stemming for query expansion but searches the query terms verbatim.
      Returns:
      the current QueryArgs
    • withScores

      public QueryArgs withScores()
      Also returns the relative internal score of each document. This can be used to merge results from multiple instances.
      Returns:
      the current QueryArgs
    • withPayloads

      public QueryArgs withPayloads()
      Retrieves optional document payloads.
      Returns:
      the current QueryArgs
    • withSortKeys

      public QueryArgs withSortKeys()
      returns the value of the sorting key, right after the id and score and/or payload, if requested. This is usually not needed, and exists for distributed search coordination purposes. This option is relevant only if used in conjunction with SORTBY.
      Returns:
      the current QueryArgs
    • filter

      public QueryArgs filter(NumericFilter filter)
      Limits results to those having numeric values ranging between min and max, if numberFilter is defined as a numeric attribute in FT.CREATE. Min and max follow ZRANGE syntax, and can be -inf, +inf, and use ( for exclusive ranges. Multiple numeric filters for different attributes are supported in one query.
      Parameters:
      filter - the filter
      Returns:
      the current QueryArgs
    • geoFilter

      public QueryArgs geoFilter(GeoFilter filter)
      Filters the results to a given radius from lon and lat. Radius is given as a number and units. See GEORADIUS for more details.
      Parameters:
      filter - the filter
      Returns:
      the current QueryArgs
    • inKeys

      public final QueryArgs inKeys(String... keys)
      Limits the result to a given set of keys specified in the list. Non-existent keys are ignored, unless all the keys are non-existent.
      Parameters:
      keys - the list of keys
      Returns:
      the current QueryArgs
    • inFields

      public QueryArgs inFields(String... fields)
      Filters the results to those appearing only in specific attributes of the document, like title or URL.
      Parameters:
      fields - the list of fields
      Returns:
      the current QueryArgs
    • returnAttribute

      public QueryArgs returnAttribute(String field, String alias)
      Limits the attributes returned from the document. If no return clauses are passed, it acts like NOCONTENT. field is either an attribute name (for hashes and JSON) or a JSON Path expression (for JSON). alias is the optional name used in the result. If not provided, the field is used in the result.
      Parameters:
      field - the field
      alias - the alias
      Returns:
      the current QueryArgs
    • returnAttribute

      public QueryArgs returnAttribute(String field)
      Limits the attributes returned from the document. If no return clauses are passed, it acts like NOCONTENT. field is either an attribute name (for hashes and JSON) or a JSON Path expression (for JSON). alias is the name used in the result. As it is not provided, the field is used in the result.
      Parameters:
      field - the field
      Returns:
      the current QueryArgs
    • summarize

      public QueryArgs summarize(SummarizeArgs args)
      Returns only the sections of the attribute that contain the matched text.
      Parameters:
      args - the summarize argument
      Returns:
      the current QueryArgs
    • highlight

      public QueryArgs highlight(HighlightArgs args)
      formats occurrences of matched text.
      Parameters:
      args - the summarize argument
      Returns:
      the current QueryArgs
    • slop

      public QueryArgs slop(int slop)
      Allows a maximum of slop intervening number of unmatched offsets between phrase terms. In other words, the slop for exact phrases is 0.
      Parameters:
      slop - the slop
      Returns:
      the current QueryArgs
    • inOrder

      public QueryArgs inOrder()
      Puts the query terms in the same order in the document as in the query, regardless of the offsets between them. Typically used in conjunction with SLOP.
      Returns:
      the current QueryArgs
    • language

      public QueryArgs language(String lang)
      Use a stemmer for the supplied language during search for query expansion. If querying documents in Chinese, set to chinese to properly tokenize the query terms. Defaults to English. If an unsupported language is sent, the command returns an error.
      Parameters:
      lang - the language
      Returns:
      the current QueryArgs
    • expander

      public QueryArgs expander(String expander)
      Uses a custom query expander instead of the stemmer.
      Parameters:
      expander - the expander
      Returns:
      the current QueryArgs
    • scorer

      public QueryArgs scorer(String scorer)
      Uses a custom scoring function you define
      Parameters:
      scorer - the scorer
      Returns:
      the current QueryArgs
    • explainScore

      public QueryArgs explainScore()
      Returns a textual description of how the scores were calculated. Using this options requires the sCORES option.
      Returns:
      the current QueryArgs
    • sortByAscending

      public QueryArgs sortByAscending(String field)
      Orders the results by the value of this attribute. Use ascending order. This applies to both text and numeric attributes. Attributes needed for SORTBY should be declared as SORTABLE in the index, in order to be available with very low latency. Note that this adds memory overhead.
      Parameters:
      field - the field
      Returns:
      the current QueryArgs
    • sortByDescending

      public QueryArgs sortByDescending(String field)
      Orders the results by the value of this attribute. Use descending order. This applies to both text and numeric attributes. Attributes needed for SORTBY should be declared as SORTABLE in the index, in order to be available with very low latency. Note that this adds memory overhead.
      Parameters:
      field - the field
      Returns:
      the current QueryArgs
    • limit

      public QueryArgs limit(int offset, int count)
      Limits the results to the offset and number of results given. Note that the offset is zero-indexed. The default is 0 10, which returns 10 items starting from the first result. You can use LIMIT 0 0 to count the number of documents in the result set without actually returning them.
      Parameters:
      offset - the offset
      count - the count
      Returns:
      the current QueryArgs
    • timeout

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

      public QueryArgs param(String name, String 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 as String
      Returns:
      the current QueryArgs
    • param

      public QueryArgs param(String name, byte[] value)
      Defines a parameter with a byte array value.
      Parameters:
      name - the parameter name
      value - the parameter value as byte array
      Returns:
      the current QueryArgs
    • param

      public QueryArgs param(String name, float[] value)
      Defines a parameter with a float array value.
      Parameters:
      name - the parameter name
      value - the parameter value as array of floats
      Returns:
      the current QueryArgs
    • param

      public QueryArgs param(String name, double[] value)
      Defines a parameter with a double array value.
      Parameters:
      name - the parameter name
      value - the parameter value as array of doubles
      Returns:
      the current QueryArgs
    • param

      public QueryArgs param(String name, int[] value)
      Defines a parameter with an int array value.
      Parameters:
      name - the parameter name
      value - the parameter value as array of ints
      Returns:
      the current QueryArgs
    • param

      public QueryArgs param(String name, long[] value)
      Defines a parameter with a long array value.
      Parameters:
      name - the parameter name
      value - the parameter value as array of longs
      Returns:
      the current QueryArgs
    • dialect

      public QueryArgs 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 QueryArgs
    • toArgs

      public List<Object> toArgs(Codec encoder)
      Specified by:
      toArgs in interface RedisCommandExtraArguments
      Parameters:
      encoder - an optional encoder to encode some of the values
      Returns:
      the list of arguments.
    • containsScore

      public boolean containsScore()
    • containsPayload

      public boolean containsPayload()
    • containsSortKeys

      public boolean containsSortKeys()