Class AbstractSearchPredicateFactory<S extends ExtendedSearchPredicateFactory<S>,SC extends SearchPredicateIndexScope<?>>
- All Implemented Interfaces:
ExtendedSearchPredicateFactory<S>
,SearchPredicateFactory
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionand()
Match documents if they match all inner clauses.and
(PredicateFinalStep firstSearchPredicate, PredicateFinalStep... otherSearchPredicate) Match documents if they match all clauses.and
(SearchPredicate firstSearchPredicate, SearchPredicate... otherSearchPredicates) Match documents if they match all previously-builtSearchPredicate
.bool()
Match documents if they match a combination of boolean clauses.bool
(Consumer<? super BooleanPredicateClausesStep<?>> clauseContributor) Match documents if they match a combination of boolean clauses, which will be defined by the given consumer.exists()
Match documents where a given field exists.Create a DSL step allowing multiple attempts to apply extensions one after the other, failing only if none of the extensions is supported.<T> T
extension
(SearchPredicateFactoryExtension<T> extension) Extend the current factory with the given extension, resulting in an extended factory offering different types of predicates.id()
Match documents where the identifier is among the given values.knn
(int k) Matchk
documents whose vector field value is nearest to the given vector.match()
Match documents where targeted fields have a value that "matches" a given single value.matchAll()
Match all documents.Match none of the documents.Match documents if they match a combination of defined named predicate clauses.nested()
Deprecated.Match documents where anested object
matches inner predicates to be defined in the next steps.not
(PredicateFinalStep searchPredicate) Match documents that do not satisfy the passed in predicate.not
(SearchPredicate searchPredicate) Match documents that do not satisfy the passed in previously-builtSearchPredicate
.or()
Match documents if they match any inner clause.or
(PredicateFinalStep firstSearchPredicate, PredicateFinalStep... otherSearchPredicate) Match documents if they match any clause.or
(SearchPredicate firstSearchPredicate, SearchPredicate... otherSearchPredicate) Match documents if they match any previously-builtSearchPredicate
.phrase()
Match documents where targeted fields have a value that contains a given phrase.prefix()
Match documents where targeted fields have a value that starts with a given string.Match documents according to a given query string, using the Lucene's query language.range()
Match documents where targeted fields have a value within lower and upper bounds.regexp()
Match documents where targeted fields contain a term that matches a given regular expression.Match documents according to a given query string, with a simple query language adapted to end users.spatial()
Access the different types of spatial predicates.terms()
Match documents where targeted fields contain a term that matches some terms of a given series of terms.final String
toAbsolutePath
(String relativeFieldPath) wildcard()
Match documents where targeted fields contain a term that matches a given pattern, such asinter*on
orpa?t
.withParameters
(Function<? super NamedValues, ? extends PredicateFinalStep> predicateCreator) Delegating predicate that creates the actual predicate at query create time and provides access to query parameters.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hibernate.search.engine.search.predicate.dsl.ExtendedSearchPredicateFactory
withRoot
-
Field Details
-
dslContext
-
-
Constructor Details
-
AbstractSearchPredicateFactory
-
-
Method Details
-
matchAll
Description copied from interface:SearchPredicateFactory
Match all documents.- Specified by:
matchAll
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "match all" predicate can be defined.
- See Also:
-
matchNone
Description copied from interface:SearchPredicateFactory
Match none of the documents.- Specified by:
matchNone
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "match none" predicate can be defined.
- See Also:
-
id
Description copied from interface:SearchPredicateFactory
Match documents where the identifier is among the given values.- Specified by:
id
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL allowing the definition of an "id" predicate.
- See Also:
-
bool
Description copied from interface:SearchPredicateFactory
Match documents if they match a combination of boolean clauses.- Specified by:
bool
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "boolean" predicate can be defined.
- See Also:
-
and
Description copied from interface:SearchPredicateFactory
Match documents if they match all inner clauses.- Specified by:
and
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where predicates that must match can be added and options can be set.
- See Also:
-
and
public SimpleBooleanPredicateOptionsStep<?> and(SearchPredicate firstSearchPredicate, SearchPredicate... otherSearchPredicates) Description copied from interface:SearchPredicateFactory
Match documents if they match all previously-builtSearchPredicate
.- Specified by:
and
in interfaceSearchPredicateFactory
- Returns:
- The step of a DSL where options can be set.
-
and
public SimpleBooleanPredicateOptionsStep<?> and(PredicateFinalStep firstSearchPredicate, PredicateFinalStep... otherSearchPredicate) Description copied from interface:SearchPredicateFactory
Match documents if they match all clauses.- Specified by:
and
in interfaceSearchPredicateFactory
- Returns:
- The step of a DSL where options can be set.
-
or
Description copied from interface:SearchPredicateFactory
Match documents if they match any inner clause.- Specified by:
or
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where predicates that should match can be added and options can be set.
- See Also:
-
or
public SimpleBooleanPredicateOptionsStep<?> or(SearchPredicate firstSearchPredicate, SearchPredicate... otherSearchPredicate) Description copied from interface:SearchPredicateFactory
Match documents if they match any previously-builtSearchPredicate
.- Specified by:
or
in interfaceSearchPredicateFactory
- Returns:
- The step of a DSL where options can be set.
-
or
public SimpleBooleanPredicateOptionsStep<?> or(PredicateFinalStep firstSearchPredicate, PredicateFinalStep... otherSearchPredicate) Description copied from interface:SearchPredicateFactory
Match documents if they match any clause.- Specified by:
or
in interfaceSearchPredicateFactory
- Returns:
- The step of a DSL where options can be set.
-
not
Description copied from interface:SearchPredicateFactory
Match documents that do not satisfy the passed in previously-builtSearchPredicate
.Can be used to negate a predicate.
- Specified by:
not
in interfaceSearchPredicateFactory
- Returns:
- The initial and final step of a DSL where the "not" predicate can be defined.
- See Also:
-
not
Description copied from interface:SearchPredicateFactory
Match documents that do not satisfy the passed in predicate.Can be used to negate a predicate.
- Specified by:
not
in interfaceSearchPredicateFactory
- Returns:
- The initial and final step of a DSL where the "not" predicate can be defined.
- See Also:
-
bool
Description copied from interface:SearchPredicateFactory
Match documents if they match a combination of boolean clauses, which will be defined by the given consumer.Best used with lambda expressions.
- Specified by:
bool
in interfaceSearchPredicateFactory
- Parameters:
clauseContributor
- A consumer that will add clauses to the step passed in parameter. Should generally be a lambda expression.- Returns:
- The final step of the boolean predicate definition.
- See Also:
-
match
Description copied from interface:SearchPredicateFactory
Match documents where targeted fields have a value that "matches" a given single value.Note 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.
- Specified by:
match
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "match" predicate can be defined.
- See Also:
-
range
Description copied from interface:SearchPredicateFactory
Match documents where targeted fields have a value within lower and upper bounds.- Specified by:
range
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "range" predicate can be defined.
- See Also:
-
phrase
Description copied from interface:SearchPredicateFactory
Match documents where targeted fields have a value that contains a given phrase.- Specified by:
phrase
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "phrase" predicate can be defined.
- See Also:
-
wildcard
Description copied from interface:SearchPredicateFactory
Match documents where targeted fields contain a term that matches a given pattern, such asinter*on
orpa?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, ...).
- Specified by:
wildcard
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "wildcard" predicate can be defined.
- See Also:
-
prefix
Description copied from interface:SearchPredicateFactory
Match documents where targeted fields have a value that starts with a given string.- Specified by:
prefix
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "prefix" predicate can be defined.
- See Also:
-
regexp
Description copied from interface:SearchPredicateFactory
Match documents where targeted fields contain a term that matches a given regular expression.- Specified by:
regexp
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "regexp" predicate can be defined.
- See Also:
-
terms
Description copied from interface:SearchPredicateFactory
Match documents where targeted fields contain a term that matches some terms of a given series of terms.- Specified by:
terms
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "terms" predicate can be defined.
- See Also:
-
nested
Deprecated.Description copied from interface:SearchPredicateFactory
Match documents where anested object
matches a given predicate.- Specified by:
nested
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "nested" predicate can be defined.
- See Also:
-
nested
Description copied from interface:SearchPredicateFactory
Match documents where anested object
matches inner predicates to be defined in the next steps.The resulting nested predicate must match all inner clauses, similarly to an
"and" predicate
.- Specified by:
nested
in interfaceSearchPredicateFactory
- Parameters:
objectFieldPath
- The path to the (nested) object field that must match.- Returns:
- The initial step of a DSL where the "nested" predicate can be defined.
- See Also:
-
simpleQueryString
Description copied from interface:SearchPredicateFactory
Match documents according to a given query string, with a simple query language adapted to end users.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
CommonQueryStringPredicateOptionsStep.defaultOperator(BooleanOperator)
to change this behavior.- Specified by:
simpleQueryString
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "simple query string" predicate can be defined.
- See Also:
-
queryString
Description copied from interface:SearchPredicateFactory
Match documents according to a given query string, using the Lucene's query language.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
CommonQueryStringPredicateOptionsStep.defaultOperator(BooleanOperator)
to change this behavior.- Specified by:
queryString
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "query string" predicate can be defined.
- See Also:
-
exists
Description copied from interface:SearchPredicateFactory
Match documents where a given field exists.Fields are considered to exist in a document when they have at least one non-null value in this document.
- Specified by:
exists
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where the "exists" predicate can be defined.
- See Also:
-
spatial
Description copied from interface:SearchPredicateFactory
Access the different types of spatial predicates.- Specified by:
spatial
in interfaceSearchPredicateFactory
- Returns:
- The initial step of a DSL where spatial predicates can be defined.
- See Also:
-
named
Description copied from interface:SearchPredicateFactory
Match documents if they match a combination of defined named predicate clauses.- Specified by:
named
in interfaceSearchPredicateFactory
- Parameters:
path
- The path to the named predicate, formatted as<object field path>.<predicate name>
, or just<predicate name>
if the predicate was declared at the root.- Returns:
- The initial step of a DSL where named predicate predicates can be defined.
- See Also:
-
knn
Description copied from interface:SearchPredicateFactory
Matchk
documents whose vector field value is nearest to the given vector."knn" stands for "K-Nearest Neighbors"; it is a form of vector search.
- Specified by:
knn
in interfaceSearchPredicateFactory
- Parameters:
k
- The number of nearest neighbors to look for.- Returns:
- The initial step of a DSL where knn predicate options can be defined.
- See Also:
-
withParameters
public PredicateFinalStep withParameters(Function<? super NamedValues, ? extends PredicateFinalStep> predicateCreator) Description copied from interface:SearchPredicateFactory
Delegating predicate that creates the actual predicate at query create time and provides access to query parameters.Which predicate exactly to create is defined by a function passed to the arguments of this predicate.
- Specified by:
withParameters
in interfaceSearchPredicateFactory
- Parameters:
predicateCreator
- The function defining an actual predicate to apply.- Returns:
- A final DSL step in a parameterized predicate definition.
-
extension
Description copied from interface:SearchPredicateFactory
Extend the current factory with the given extension, resulting in an extended factory offering different types of predicates.- Specified by:
extension
in interfaceSearchPredicateFactory
- Type Parameters:
T
- The type of factory provided by the extension.- Parameters:
extension
- The extension to the predicate DSL.- Returns:
- The extended factory.
-
extension
Description copied from interface:SearchPredicateFactory
Create a DSL step allowing multiple attempts to apply extensions one after the other, failing only if none of the extensions is supported.If you only need to apply a single extension and fail if it is not supported, use the simpler
SearchPredicateFactory.extension(SearchPredicateFactoryExtension)
method instead.- Specified by:
extension
in interfaceSearchPredicateFactory
- Returns:
- A DSL step.
-
toAbsolutePath
- Specified by:
toAbsolutePath
in interfaceSearchPredicateFactory
- Parameters:
relativeFieldPath
- The path to a field, relative to theroot
of this factory.- Returns:
- The absolute path of the field, for use in native predicates for example. Note the path is returned even if the field doesn't exist.
-