Class AbstractSearchPredicateFactory<S extends ExtendedSearchPredicateFactory<S>,SC extends SearchPredicateIndexScope<?>>
- java.lang.Object
-
- org.hibernate.search.engine.search.predicate.dsl.spi.AbstractSearchPredicateFactory<S,SC>
-
- All Implemented Interfaces:
ExtendedSearchPredicateFactory<S>
,SearchPredicateFactory
public abstract class AbstractSearchPredicateFactory<S extends ExtendedSearchPredicateFactory<S>,SC extends SearchPredicateIndexScope<?>> extends Object implements ExtendedSearchPredicateFactory<S>
-
-
Field Summary
Fields Modifier and Type Field Description protected SearchPredicateDslContext<SC>
dslContext
-
Constructor Summary
Constructors Constructor Description AbstractSearchPredicateFactory(SearchPredicateDslContext<SC> dslContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleanPredicateClausesStep<?>
bool()
Match documents if they match a combination of boolean clauses.PredicateFinalStep
bool(Consumer<? super BooleanPredicateClausesStep<?>> clauseContributor)
Match documents if they match a combination of boolean clauses, which will be defined by the given consumer.ExistsPredicateFieldStep<?>
exists()
Match documents where a given field exists.SearchPredicateFactoryExtensionIfSupportedStep
extension()
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.MatchIdPredicateMatchingStep<?>
id()
Match documents where the identifier is among the given values.MatchPredicateFieldStep<?>
match()
Match documents where targeted fields have a value that "matches" a given single value.MatchAllPredicateOptionsStep<?>
matchAll()
Match all documents.NamedPredicateOptionsStep
named(String path)
Match documents if they match a combination of defined named predicate clauses.NestedPredicateFieldStep<?>
nested()
Match documents where anested object
matches a given predicate.PhrasePredicateFieldStep<?>
phrase()
Match documents where targeted fields have a value that contains a given phrase.RangePredicateFieldStep<?>
range()
Match documents where targeted fields have a value within lower and upper bounds.RegexpPredicateFieldStep<?>
regexp()
Match documents where targeted fields contain a term that matches a given regular expression.SimpleQueryStringPredicateFieldStep<?>
simpleQueryString()
Match documents according to a given query string, with a simple query language adapted to end users.SpatialPredicateInitialStep
spatial()
Access the different types of spatial predicates.TermsPredicateFieldStep<?>
terms()
Match documents where targeted fields contain a term that matches some terms of a given series of terms.String
toAbsolutePath(String relativeFieldPath)
WildcardPredicateFieldStep<?>
wildcard()
Match documents where targeted fields contain a term that matches a given pattern, such asinter*on
orpa?t
.-
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 Detail
-
dslContext
protected final SearchPredicateDslContext<SC extends SearchPredicateIndexScope<?>> dslContext
-
-
Constructor Detail
-
AbstractSearchPredicateFactory
public AbstractSearchPredicateFactory(SearchPredicateDslContext<SC> dslContext)
-
-
Method Detail
-
matchAll
public MatchAllPredicateOptionsStep<?> 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:
MatchAllPredicateOptionsStep
-
id
public MatchIdPredicateMatchingStep<?> 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:
MatchIdPredicateMatchingStep
-
bool
public BooleanPredicateClausesStep<?> 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:
BooleanPredicateClausesStep
-
bool
public PredicateFinalStep bool(Consumer<? super BooleanPredicateClausesStep<?>> clauseContributor)
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:
BooleanPredicateClausesStep
-
match
public MatchPredicateFieldStep<?> 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:
MatchPredicateFieldStep
-
range
public RangePredicateFieldStep<?> 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:
RangePredicateFieldStep
-
phrase
public PhrasePredicateFieldStep<?> 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:
PhrasePredicateFieldStep
-
wildcard
public WildcardPredicateFieldStep<?> 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:
WildcardPredicateFieldStep
-
regexp
public RegexpPredicateFieldStep<?> 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:
RegexpPredicateFieldStep
-
terms
public TermsPredicateFieldStep<?> 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:
TermsPredicateFieldStep
-
nested
public NestedPredicateFieldStep<?> nested()
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:
NestedPredicateFieldStep
-
simpleQueryString
public SimpleQueryStringPredicateFieldStep<?> 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
SimpleQueryStringPredicateOptionsStep.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:
SimpleQueryStringPredicateFieldStep
-
exists
public ExistsPredicateFieldStep<?> 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:
ExistsPredicateFieldStep
-
spatial
public SpatialPredicateInitialStep 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:
SpatialPredicateInitialStep
-
named
public NamedPredicateOptionsStep named(String path)
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:
NamedPredicateOptionsStep
-
extension
public <T> T extension(SearchPredicateFactoryExtension<T> 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
public SearchPredicateFactoryExtensionIfSupportedStep 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
public final String toAbsolutePath(String relativeFieldPath)
- 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.
-
-