Class QueryBuilder
- java.lang.Object
-
- com.redis.lettucemod.search.querybuilder.QueryBuilder
-
public class QueryBuilder extends java.lang.ObjectCreated 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. You can useimport static
for these helper methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static QueryNodedisjunct(Node... n)Create a disjunct node.static QueryNodedisjunct(java.lang.String field, Value... values)Create a disjunct node using one or more values.static QueryNodedisjunct(java.lang.String field, java.lang.String... values)Create a disjunct node using one or more values.static QueryNodedisjunctUnion(Node... n)Create a disjunct union node.static QueryNodedisjunctUnion(java.lang.String field, Value... values)static QueryNodedisjunctUnion(java.lang.String field, java.lang.String... values)static QueryNodeintersect(Node... n)Create a new intersection node with child nodes.static QueryNodeintersect(java.lang.String field, Value... values)Create a new intersection node with a field-value pair.static QueryNodeintersect(java.lang.String field, java.lang.String stringValue)Helper method to create a new intersection node with a string value.static QueryNodeoptional(Node... n)Create an optional node.static QueryNodeoptional(java.lang.String field, Value... values)static QueryNodeunion(Node... n)Create a union node.static QueryNodeunion(java.lang.String field, Value... values)Create a union node which can match an one or more valuesstatic QueryNodeunion(java.lang.String field, java.lang.String... values)Convenience method to match one or more strings.
-
-
-
Method Detail
-
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(java.lang.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(java.lang.String field, java.lang.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(java.lang.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 checkedvalues- Values to search for. The node evaluates to true iffieldmatches any of the values- Returns:
- The union node
-
union
public static QueryNode union(java.lang.String field, java.lang.String... values)
Convenience method to match one or more strings. This is equivalent tounion(field, value(v1), value(v2), value(v3)) ...- Parameters:
field- Field to matchvalues- 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(java.lang.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(java.lang.String field, java.lang.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(java.lang.String field, java.lang.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
-
-