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<?>>,CommonMinimumShouldMatchOptionsStep<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
ConstructorsConstructorDescriptionBooleanPredicateClausesStepImpl(SearchPredicateDslContext<?> dslContext, SearchPredicateFactory factory) -
Method Summary
Modifier and TypeMethodDescriptionboost(float boost) Boost the weight of the predicate in score computation.protected SearchPredicatebuild()Force the score of the predicate to a single constant, identical for all documents.filter(Function<? super SearchPredicateFactory, ? extends PredicateFinalStep> clauseContributor) Add a "filter" clause to be defined by the given function.filter(SearchPredicate searchPredicate) Add a "filter" clause based on a previously-builtSearchPredicate.booleanChecks if this predicate contains at least one clause.minimumShouldMatch(Consumer<? super MinimumShouldMatchConditionStep<?>> constraintContributor) Start defining the minimum number of "should" constraints that have to match in order for the boolean predicate to match.must(Function<? super SearchPredicateFactory, ? extends PredicateFinalStep> clauseContributor) Add a "must" clause to be defined by the given function.must(SearchPredicate searchPredicate) Add a "must" clause based on a previously-builtSearchPredicate.mustNot(Function<? super SearchPredicateFactory, ? extends PredicateFinalStep> clauseContributor) Add a "must not" clause to be defined by the given function.mustNot(SearchPredicate searchPredicate) Add a "must not" clause based on a previously-builtSearchPredicate.protected BooleanPredicateClausesStepImplself()should(Function<? super SearchPredicateFactory, ? extends PredicateFinalStep> clauseContributor) Add a "should" clause to be defined by the given function.should(SearchPredicate searchPredicate) Add a "should" clause based on a previously-builtSearchPredicate.with(Consumer<? super BooleanPredicateOptionsCollector<?>> contributor) Delegates setting clauses and options to a given consumer.Methods inherited from class org.hibernate.search.engine.search.predicate.dsl.spi.AbstractPredicateFinalStep
toPredicateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.search.engine.search.predicate.dsl.BooleanPredicateOptionsCollector
hasClauseMethods 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, withMethods inherited from interface org.hibernate.search.engine.search.predicate.dsl.PredicateFinalStep
toPredicateMethods inherited from interface org.hibernate.search.engine.search.predicate.dsl.PredicateScoreStep
boost, constantScore
-
Constructor Details
-
BooleanPredicateClausesStepImpl
public BooleanPredicateClausesStepImpl(SearchPredicateDslContext<?> dslContext, SearchPredicateFactory factory)
-
-
Method Details
-
self
-
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
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 BooleanPredicateClausesStepImpl with(Consumer<? super BooleanPredicateOptionsCollector<?>> 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
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
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
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
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 BooleanPredicateClausesStepImpl 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 BooleanPredicateClausesStepImpl 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 BooleanPredicateClausesStepImpl 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 BooleanPredicateClausesStepImpl 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
- Specified by:
minimumShouldMatchin interfaceCommonMinimumShouldMatchOptionsStep<S extends C>- Specified by:
minimumShouldMatchin interfaceGenericBooleanPredicateClausesStep<S extends C,C extends BooleanPredicateOptionsCollector<?>>
-
minimumShouldMatch
public BooleanPredicateClausesStepImpl minimumShouldMatch(Consumer<? super MinimumShouldMatchConditionStep<?>> constraintContributor) Description copied from interface:CommonMinimumShouldMatchOptionsStepStart defining the minimum number of "should" constraints that have to match in order for the boolean predicate to match.- Specified by:
minimumShouldMatchin interfaceCommonMinimumShouldMatchOptionsStep<S extends C>- Specified by:
minimumShouldMatchin interfaceGenericBooleanPredicateClausesStep<S extends C,C extends BooleanPredicateOptionsCollector<?>> - Returns:
- A
MinimumShouldMatchConditionStepwhere constraints can be defined.
-
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.
-