public class DelegatingSearchPredicateFactoryContext extends Object implements SearchPredicateFactoryContext
SearchPredicateFactoryContext.
Mainly useful when implementing a SearchPredicateFactoryContextExtension.
| Constructor and Description |
|---|
DelegatingSearchPredicateFactoryContext(SearchPredicateFactoryContext delegate) |
| Modifier and Type | Method and Description |
|---|---|
BooleanJunctionPredicateContext |
bool()
Match documents if they match a combination of boolean clauses.
|
SearchPredicateTerminalContext |
bool(Consumer<? super BooleanJunctionPredicateContext> clauseContributor)
Match documents if they match a combination of boolean clauses,
which will be defined by the given consumer.
|
SearchPredicateFactoryExtensionContext |
extension()
Create a context allowing to try to apply multiple extensions one after the other,
failing only if none of the extensions is supported.
|
<T> T |
extension(SearchPredicateFactoryContextExtension<T> extension)
Extend the current context with the given extension,
resulting in an extended context offering different types of predicates.
|
protected SearchPredicateFactoryContext |
getDelegate() |
MatchIdPredicateContext |
id()
Match documents where the identifier is among the given values.
|
MatchPredicateContext |
match()
Match documents where targeted fields have a value that "matches" a given single value.
|
MatchAllPredicateContext |
matchAll()
Match all documents.
|
NestedPredicateContext |
nested()
Match documents where a
nested object
matches a given predicate. |
PhrasePredicateContext |
phrase()
Match documents where targeted fields have a value that contains a given phrase.
|
RangePredicateContext |
range()
Match documents where targeted fields have a value within lower and upper bounds.
|
SimpleQueryStringPredicateContext |
simpleQueryString()
Match documents according to a given query string,
with a simple query language adapted to end users.
|
SpatialPredicateContext |
spatial()
Access the different types of spatial predicates.
|
WildcardPredicateContext |
wildcard()
Match documents where targeted fields contain a term that matches a given pattern,
such as
inter*on or pa?t. |
public DelegatingSearchPredicateFactoryContext(SearchPredicateFactoryContext delegate)
public MatchAllPredicateContext matchAll()
SearchPredicateFactoryContextmatchAll in interface SearchPredicateFactoryContextget the resulting predicate.MatchAllPredicateContextpublic MatchIdPredicateContext id()
SearchPredicateFactoryContextid in interface SearchPredicateFactoryContextget the resulting predicate.MatchIdPredicateContextpublic BooleanJunctionPredicateContext bool()
SearchPredicateFactoryContextbool in interface SearchPredicateFactoryContextget the resulting predicate.BooleanJunctionPredicateContextpublic SearchPredicateTerminalContext bool(Consumer<? super BooleanJunctionPredicateContext> clauseContributor)
SearchPredicateFactoryContextBest used with lambda expressions.
bool in interface SearchPredicateFactoryContextclauseContributor - A consumer that will add clauses to the context passed in parameter.
Should generally be a lambda expression.SearchPredicateBooleanJunctionPredicateContextpublic MatchPredicateContext match()
SearchPredicateFactoryContextNote that "value matching" may be exact or approximate depending on the type of the targeted fields: numeric fields in particular imply exact matches, while analyzed, full-text fields imply approximate matches depending on how they are analyzed.
match in interface SearchPredicateFactoryContextget the resulting predicate.MatchPredicateContextpublic RangePredicateContext range()
SearchPredicateFactoryContextrange in interface SearchPredicateFactoryContextget the resulting predicate.RangePredicateContextpublic PhrasePredicateContext phrase()
SearchPredicateFactoryContextphrase in interface SearchPredicateFactoryContextget the resulting predicate.PhrasePredicateContextpublic WildcardPredicateContext wildcard()
SearchPredicateFactoryContextinter*on or pa?t.
Note that such patterns are not analyzed, thus any character that is not a wildcard must match exactly the content of the index (including uppercase letters, diacritics, ...).
wildcard in interface SearchPredicateFactoryContextget the resulting predicate.WildcardPredicateContextpublic NestedPredicateContext nested()
SearchPredicateFactoryContextnested object
matches a given predicate.nested in interface SearchPredicateFactoryContextget the resulting predicate.NestedPredicateContextpublic SimpleQueryStringPredicateContext simpleQueryString()
SearchPredicateFactoryContext
Note that by default, unless the query string contains explicit operators,
documents will match if any term mentioned in the query string is present in the document (OR operator).
This makes sense when sorting results by relevance, but is not ideal otherwise.
See SimpleQueryStringPredicateTerminalContext.withAndAsDefaultOperator() to change this behavior.
simpleQueryString in interface SearchPredicateFactoryContextget the resulting predicate.SimpleQueryStringPredicateContextpublic SpatialPredicateContext spatial()
SearchPredicateFactoryContextspatial in interface SearchPredicateFactoryContextSpatialPredicateContextpublic <T> T extension(SearchPredicateFactoryContextExtension<T> extension)
SearchPredicateFactoryContextextension in interface SearchPredicateFactoryContextT - The type of context provided by the extension.extension - The extension to the predicate DSL.public SearchPredicateFactoryExtensionContext extension()
SearchPredicateFactoryContext
If you only need to apply a single extension and fail if it is not supported,
use the simpler SearchPredicateFactoryContext.extension(SearchPredicateFactoryContextExtension) method instead.
extension in interface SearchPredicateFactoryContextprotected SearchPredicateFactoryContext getDelegate()
Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.