Class BooleanPredicateClausesStepImpl
- java.lang.Object
-
- org.hibernate.search.engine.search.predicate.dsl.spi.AbstractPredicateFinalStep
-
- org.hibernate.search.engine.search.predicate.dsl.impl.BooleanPredicateClausesStepImpl
-
- All Implemented Interfaces:
BooleanPredicateClausesStep<BooleanPredicateClausesStepImpl>,BooleanPredicateOptionsCollector<BooleanPredicateOptionsCollector<?>>,GenericBooleanPredicateClausesStep<BooleanPredicateClausesStepImpl,BooleanPredicateOptionsCollector<?>>,PredicateFinalStep,PredicateScoreStep<BooleanPredicateClausesStepImpl>
public final class BooleanPredicateClausesStepImpl extends AbstractPredicateFinalStep implements BooleanPredicateClausesStep<BooleanPredicateClausesStepImpl>
-
-
Field Summary
-
Fields inherited from class org.hibernate.search.engine.search.predicate.dsl.spi.AbstractPredicateFinalStep
dslContext
-
-
Constructor Summary
Constructors Constructor Description BooleanPredicateClausesStepImpl(SearchPredicateDslContext<?> dslContext, SearchPredicateFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Sboost(float boost)Boost the weight of the predicate in score computation.protected SearchPredicatebuild()SconstantScore()Force the score of the predicate to a single constant, identical for all documents.Sfilter(Function<? super SearchPredicateFactory,? extends PredicateFinalStep> clauseContributor)Add a "filter" clause to be defined by the given function.Sfilter(SearchPredicate searchPredicate)Add a "filter" clause based on a previously-builtSearchPredicate.booleanhasClause()Checks if this predicate contains at least one clause.MinimumShouldMatchConditionStep<S>minimumShouldMatch()Start defining the minimum number of "should" constraints that have to match in order for the boolean predicate to match.SminimumShouldMatch(Consumer<? super MinimumShouldMatchConditionStep<?>> constraintContributor)Start defining the minimum number of "should" constraints that have to match in order for the boolean predicate to match.Smust(Function<? super SearchPredicateFactory,? extends PredicateFinalStep> clauseContributor)Add a "must" clause to be defined by the given function.Smust(SearchPredicate searchPredicate)Add a "must" clause based on a previously-builtSearchPredicate.SmustNot(Function<? super SearchPredicateFactory,? extends PredicateFinalStep> clauseContributor)Add a "must not" clause to be defined by the given function.SmustNot(SearchPredicate searchPredicate)Add a "must not" clause based on a previously-builtSearchPredicate.protected BooleanPredicateClausesStepImplself()Sshould(Function<? super SearchPredicateFactory,? extends PredicateFinalStep> clauseContributor)Add a "should" clause to be defined by the given function.Sshould(SearchPredicate searchPredicate)Add a "should" clause based on a previously-builtSearchPredicate.Swith(Consumer<? super C> contributor)Delegates setting clauses and options to a given consumer.-
Methods inherited from class org.hibernate.search.engine.search.predicate.dsl.spi.AbstractPredicateFinalStep
toPredicate
-
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.BooleanPredicateOptionsCollector
hasClause
-
Methods inherited from interface org.hibernate.search.engine.search.predicate.dsl.GenericBooleanPredicateClausesStep
filter, filter, filter, minimumShouldMatch, minimumShouldMatch, minimumShouldMatchNumber, minimumShouldMatchPercent, must, must, must, mustNot, mustNot, mustNot, should, should, should, with
-
Methods inherited from interface org.hibernate.search.engine.search.predicate.dsl.PredicateFinalStep
toPredicate
-
Methods inherited from interface org.hibernate.search.engine.search.predicate.dsl.PredicateScoreStep
boost, constantScore
-
-
-
-
Constructor Detail
-
BooleanPredicateClausesStepImpl
public BooleanPredicateClausesStepImpl(SearchPredicateDslContext<?> dslContext, SearchPredicateFactory factory)
-
-
Method Detail
-
self
protected BooleanPredicateClausesStepImpl self()
-
boost
public S boost(float boost)
Description copied from interface:PredicateScoreStepBoost the weight of the predicate in score computation.- Specified by:
boostin interfacePredicateScoreStep<S extends C>- Parameters:
boost- The boost factor. Higher than 1 increases the weight in score computation, between 0 and 1 lowers the weight. Lower than 0 is for experts only.- Returns:
this, for method chaining.
-
constantScore
public S constantScore()
Description copied from interface:PredicateScoreStepForce the score of the predicate to a single constant, identical for all documents.By default, the score will be
1.0f, butboosts, if any, will still be applied to the predicate.- Specified by:
constantScorein interfacePredicateScoreStep<S extends C>- Returns:
this, for method chaining.
-
with
public S with(Consumer<? super C> contributor)
Description copied from interface:BooleanPredicateOptionsCollectorDelegates setting clauses and options to a given consumer.Best used with lambda expressions.
- Specified by:
within interfaceBooleanPredicateOptionsCollector<S extends C>- Specified by:
within interfaceGenericBooleanPredicateClausesStep<S extends C,C extends BooleanPredicateOptionsCollector<?>>- Parameters:
contributor- A consumer that will add clauses and options to the collector that it consumes. Should generally be a lambda expression.- Returns:
this, for method chaining.
-
must
public S must(SearchPredicate searchPredicate)
Description copied from interface:BooleanPredicateOptionsCollectorAdd a "must" clause based on a previously-builtSearchPredicate.- Specified by:
mustin interfaceBooleanPredicateOptionsCollector<S extends C>- Specified by:
mustin interfaceGenericBooleanPredicateClausesStep<S extends C,C extends BooleanPredicateOptionsCollector<?>>- Parameters:
searchPredicate- The predicate that must match.- Returns:
this, for method chaining.
-
mustNot
public S mustNot(SearchPredicate searchPredicate)
Description copied from interface:BooleanPredicateOptionsCollectorAdd a "must not" clause based on a previously-builtSearchPredicate.- Specified by:
mustNotin interfaceBooleanPredicateOptionsCollector<S extends C>- Specified by:
mustNotin interfaceGenericBooleanPredicateClausesStep<S extends C,C extends BooleanPredicateOptionsCollector<?>>- Parameters:
searchPredicate- The predicate that must not match.- Returns:
this, for method chaining.
-
should
public S should(SearchPredicate searchPredicate)
Description copied from interface:BooleanPredicateOptionsCollectorAdd a "should" clause based on a previously-builtSearchPredicate.- Specified by:
shouldin interfaceBooleanPredicateOptionsCollector<S extends C>- Specified by:
shouldin interfaceGenericBooleanPredicateClausesStep<S extends C,C extends BooleanPredicateOptionsCollector<?>>- Parameters:
searchPredicate- The predicate that should match.- Returns:
this, for method chaining.
-
filter
public S filter(SearchPredicate searchPredicate)
Description copied from interface:BooleanPredicateOptionsCollectorAdd a "filter" clause based on a previously-builtSearchPredicate.- Specified by:
filterin interfaceBooleanPredicateOptionsCollector<S extends C>- Specified by:
filterin interfaceGenericBooleanPredicateClausesStep<S extends C,C extends BooleanPredicateOptionsCollector<?>>- Parameters:
searchPredicate- The predicate that must match.- Returns:
this, for method chaining.
-
must
public S must(Function<? super SearchPredicateFactory,? extends PredicateFinalStep> clauseContributor)
Description copied from interface:BooleanPredicateOptionsCollectorAdd a "must" clause to be defined by the given function.Best used with lambda expressions.
- Specified by:
mustin interfaceBooleanPredicateOptionsCollector<S extends C>- Specified by:
mustin interfaceGenericBooleanPredicateClausesStep<S extends C,C extends BooleanPredicateOptionsCollector<?>>- Parameters:
clauseContributor- A function that will use the factory passed in parameter to create a predicate, returning the final step in the predicate DSL. Should generally be a lambda expression.- Returns:
this, for method chaining.
-
mustNot
public S mustNot(Function<? super SearchPredicateFactory,? extends PredicateFinalStep> clauseContributor)
Description copied from interface:BooleanPredicateOptionsCollectorAdd a "must not" clause to be defined by the given function.Best used with lambda expressions.
- Specified by:
mustNotin interfaceBooleanPredicateOptionsCollector<S extends C>- Specified by:
mustNotin interfaceGenericBooleanPredicateClausesStep<S extends C,C extends BooleanPredicateOptionsCollector<?>>- Parameters:
clauseContributor- A function that will use the factory passed in parameter to create a predicate, returning the final step in the predicate DSL. Should generally be a lambda expression.- Returns:
this, for method chaining.
-
should
public S should(Function<? super SearchPredicateFactory,? extends PredicateFinalStep> clauseContributor)
Description copied from interface:BooleanPredicateOptionsCollectorAdd a "should" clause to be defined by the given function.Best used with lambda expressions.
- Specified by:
shouldin interfaceBooleanPredicateOptionsCollector<S extends C>- Specified by:
shouldin interfaceGenericBooleanPredicateClausesStep<S extends C,C extends BooleanPredicateOptionsCollector<?>>- Parameters:
clauseContributor- A function that will use the factory passed in parameter to create a predicate, returning the final step in the predicate DSL. Should generally be a lambda expression.- Returns:
this, for method chaining.
-
filter
public S filter(Function<? super SearchPredicateFactory,? extends PredicateFinalStep> clauseContributor)
Description copied from interface:BooleanPredicateOptionsCollectorAdd a "filter" clause to be defined by the given function.Best used with lambda expressions.
- Specified by:
filterin interfaceBooleanPredicateOptionsCollector<S extends C>- Specified by:
filterin interfaceGenericBooleanPredicateClausesStep<S extends C,C extends BooleanPredicateOptionsCollector<?>>- Parameters:
clauseContributor- A function that will use the factory passed in parameter to create a predicate, returning the final step in the predicate DSL. Should generally be a lambda expression.- Returns:
this, for method chaining.
-
minimumShouldMatch
public MinimumShouldMatchConditionStep<S> minimumShouldMatch()
Description copied from interface:BooleanPredicateOptionsCollectorStart defining the minimum number of "should" constraints that have to match in order for the boolean predicate to match.- Specified by:
minimumShouldMatchin interfaceBooleanPredicateOptionsCollector<S extends C>- Specified by:
minimumShouldMatchin interfaceGenericBooleanPredicateClausesStep<S extends C,C extends BooleanPredicateOptionsCollector<?>>- Returns:
- A
MinimumShouldMatchConditionStepwhere constraints can be defined.
-
minimumShouldMatch
public S minimumShouldMatch(Consumer<? super MinimumShouldMatchConditionStep<?>> constraintContributor)
Description copied from interface:BooleanPredicateOptionsCollectorStart defining the minimum number of "should" constraints that have to match in order for the boolean predicate to match.- Specified by:
minimumShouldMatchin interfaceBooleanPredicateOptionsCollector<S extends C>- Specified by:
minimumShouldMatchin interfaceGenericBooleanPredicateClausesStep<S extends C,C extends BooleanPredicateOptionsCollector<?>>- Parameters:
constraintContributor- A consumer that will add constraints to the DSL step passed in parameter. Should generally be a lambda expression.- Returns:
this, for method chaining.
-
build
protected SearchPredicate build()
- Specified by:
buildin classAbstractPredicateFinalStep
-
hasClause
public boolean hasClause()
Description copied from interface:BooleanPredicateOptionsCollectorChecks if this predicate contains at least one clause.- Specified by:
hasClausein interfaceBooleanPredicateOptionsCollector<S extends C>- Returns:
trueif any clauses were added, i.e. any of themust(..)/should(..)/mustNot(..)/filter(..)were called at least once,falseotherwise.
-
-