@API(value=MAINTAINED) public class Field extends Object
oneOfThem()
and matches(QueryComponent)
allow you to create other components, while
the remaining functions allow you to match on the value of the associated field directly.Modifier and Type | Method and Description |
---|---|
QueryComponent |
equalsParameter(String param)
Checks if the field has a value equal to the given parameter.
|
QueryComponent |
equalsValue(Object comparand)
Checks if the field has a value equal to the given comparand.
|
QueryComponent |
greaterThan(Object comparand)
Checks if the field has a value greater than the given comparand.
|
QueryComponent |
greaterThanOrEquals(Object comparand)
Checks if the field has a value greater than or equal to the given comparand.
|
QueryComponent |
in(List<?> comparand)
Query where the value of this field is in the given list.
|
QueryComponent |
in(String param)
Query where the value of this field is in the list that is bound to the given param.
|
QueryComponent |
isEmpty()
Returns true if the repeated field does not have any occurrences.
|
QueryComponent |
isNull()
Returns true if the field has not been set and uses the default value.
|
QueryComponent |
lessThan(Object comparand)
Checks if the field has a value less than the given comparand.
|
QueryComponent |
lessThanOrEquals(Object comparand)
Checks if the field has a value less than or equal to the given comparand.
|
QueryComponent |
mapMatches(Function<Field,QueryComponent> keyMatcher,
Function<Field,QueryComponent> valueMatcher)
Match
map field entries. |
QueryComponent |
matches(QueryComponent child)
If the associated field is a submessage, this allows you to match against the fields within that submessage.
|
QueryComponent |
notEmpty()
Returns true if the repeated field has occurrences.
|
QueryComponent |
notEquals(Object comparand)
Checks if the field has a value not equal to the given comparand.
|
QueryComponent |
notNull()
Returns true if the field does not use the default value.
|
OneOfThem |
oneOfThem()
If the associated field is a repeated one, this allows you to match against one of those values, the record will
be returned if any one of the values returns true.
|
QueryComponent |
startsWith(String comparand)
Checks if the field starts with the given string.
|
Text |
text()
Query where the value of this field matches some property when performing a full-text
search.
|
Text |
text(String tokenizerName)
Query where the value of this field matches some property when performing a full-text
search.
|
Text |
text(String tokenizerName,
String defaultTokenizerName)
Query where the value of this field matches some property when performing a full-text
search.
|
@Nonnull public QueryComponent matches(@Nonnull QueryComponent child)
child
- a component asserting about the content of the submessage in this field@Nonnull public OneOfThem oneOfThem()
@Nonnull public QueryComponent equalsValue(@Nonnull Object comparand)
comparand
- the object to compare with the value in the field@Nonnull public QueryComponent notEquals(@Nonnull Object comparand)
comparand
- the object to compare with the value in the field@Nonnull public QueryComponent greaterThan(@Nonnull Object comparand)
comparand
- the object to compare with the value in the field@Nonnull public QueryComponent greaterThanOrEquals(@Nonnull Object comparand)
comparand
- the object to compare with the value in the field@Nonnull public QueryComponent lessThan(@Nonnull Object comparand)
comparand
- the object to compare with the value in the field@Nonnull public QueryComponent lessThanOrEquals(@Nonnull Object comparand)
comparand
- the object to compare with the value in the field@Nonnull public QueryComponent startsWith(@Nonnull String comparand)
comparand
- the object to compare with the value in the field@Nonnull public QueryComponent isNull()
@Nonnull public QueryComponent notNull()
@Nonnull public QueryComponent isEmpty()
@Nonnull public QueryComponent notEmpty()
@Nonnull public QueryComponent in(@Nonnull List<?> comparand)
comparand
- a list of elements@Nonnull public QueryComponent in(@Nonnull String param)
param
- a param that will be bound to a list in the execution context@Nonnull public Text text()
@Nonnull public Text text(@Nullable String tokenizerName)
tokenizerName
is not null
, then this will use that tokenizer
to tokenize the query string (if not already tokenized) and to parse the record's text. If
an index is used, then it is guaranteed that the index uses this same tokenizer. If
tokenizerName
is null
, then this behaves the same as text()
.tokenizerName
- the name of the tokenizer to use to tokenize the record and (if necessary) the query string@Nonnull public Text text(@Nullable String tokenizerName, @Nullable String defaultTokenizerName)
tokenizerName
is not null
, then this will use that tokenizer
to tokenize the query string (if not already tokenized) and to parse the record's text. If
an index is used, then it is guaranteed that the index uses this same tokenizer. If
tokenizerName
is null
, then this behaves the same as text()
except that if defaultTokenizerName
is not null
, then it will use
that tokenizer to tokenize the document and query string (if no index is available) instead
of the normal default tokenizer, DefaultTextTokenizer
.tokenizerName
- the name of the tokenizer to use to tokenize the record and (if necessary) the query stringdefaultTokenizerName
- the name of the tokenizer to use if tokenizerName
is null
and no index can be found to satisfy the query@Nonnull public QueryComponent equalsParameter(@Nonnull String param)
param
- the name of the parameter@Nonnull public QueryComponent mapMatches(@Nullable Function<Field,QueryComponent> keyMatcher, @Nullable Function<Field,QueryComponent> valueMatcher)
map
field entries.
Query.field("map_field").mapMatches(k -> k.equals("akey"), v -> v.greaterThan(10))
keyMatcher
- a function to apply to the key Field
or null
not to restrict the keyvalueMatcher
- a function to apply to the value Field
or null
not to restrict the value