Class QueryBuilders

java.lang.Object
redis.clients.jedis.search.querybuilder.QueryBuilders

public class QueryBuilders extends Object
Created by mnunberg on 2/23/18. This class contains methods to construct query nodes. These query nodes can be added to parent query nodes (building a chain) or used as the root query node.
  • Constructor Details

    • QueryBuilders

      private QueryBuilders()
  • Method Details

    • intersect

      public static QueryNode intersect(Node... n)
      Create a new intersection node with child nodes. An intersection node is true if all its children are also true
      Parameters:
      n - sub-condition to add
      Returns:
      The node
    • intersect

      public static QueryNode intersect(String field, Value... values)
      Create a new intersection node with a field-value pair.
      Parameters:
      field - The field that should contain this value. If this value is empty, then any field will be checked.
      values - Value to check for. The node will be true only if the field (or any field) contains all of the values
      Returns:
      The node
    • intersect

      public static QueryNode intersect(String field, String stringValue)
      Helper method to create a new intersection node with a string value.
      Parameters:
      field - The field to check. If left null or empty, all fields will be checked.
      stringValue - The value to check
      Returns:
      The node
    • union

      public static QueryNode union(Node... n)
      Create a union node. Union nodes evaluate to true if any of its children are true
      Parameters:
      n - Child node
      Returns:
      The union node
    • union

      public static QueryNode union(String field, Value... values)
      Create a union node which can match an one or more values
      Parameters:
      field - Field to check. If empty, all fields are checked
      values - Values to search for. The node evaluates to true if field matches any of the values
      Returns:
      The union node
    • union

      public static QueryNode union(String field, String... values)
      Convenience method to match one or more strings. This is equivalent to union(field, value(v1), value(v2), value(v3)) ...
      Parameters:
      field - Field to match
      values - Strings to check for
      Returns:
      The union node
    • disjunct

      public static QueryNode disjunct(Node... n)
      Create a disjunct node. Disjunct nodes are true iff any of its children are not true. Conversely, this node evaluates to false if all its children are true.
      Parameters:
      n - Child nodes to add
      Returns:
      The disjunct node
    • disjunct

      public static QueryNode disjunct(String field, Value... values)
      Create a disjunct node using one or more values. The node will evaluate to true iff the field does not match any of the values.
      Parameters:
      field - Field to check for (empty or null for any field)
      values - The values to check for
      Returns:
      The node
    • disjunct

      public static QueryNode disjunct(String field, String... values)
      Create a disjunct node using one or more values. The node will evaluate to true iff the field does not match any of the values.
      Parameters:
      field - Field to check for (empty or null for any field)
      values - The values to check for
      Returns:
      The node
    • disjunctUnion

      public static QueryNode disjunctUnion(Node... n)
      Create a disjunct union node. This node evaluates to true if all of its children are not true. Conversely, this node evaluates as false if any of its children are true.
      Parameters:
      n -
      Returns:
      The node
    • disjunctUnion

      public static QueryNode disjunctUnion(String field, Value... values)
    • disjunctUnion

      public static QueryNode disjunctUnion(String field, String... values)
    • optional

      public static QueryNode optional(Node... n)
      Create an optional node. Optional nodes do not affect which results are returned but they influence ordering and scoring.
      Parameters:
      n - The node to evaluate as optional
      Returns:
      The new node
    • optional

      public static QueryNode optional(String field, Value... values)