Interface BooleanJunction<T extends BooleanJunction>
-
- All Superinterfaces:
QueryCustomization<T>,Termination
- All Known Subinterfaces:
MustJunction
@Deprecated public interface BooleanJunction<T extends BooleanJunction> extends QueryCustomization<T>, Termination
Deprecated.See the deprecation note onQueryBuilder.Represents a boolean query that can contains one or more elements to join"minimumShouldMatch" constraints
"minimumShouldMatch" constraints define a minimum number of "should" clauses that have to match in order for the boolean junction to match.
The feature is similar, and will work identically, to "Min Number Should Match" in Solr or
minimum_should_matchin Elasticsearch.Definition of the minimum
The minimum may be defined either directly as a positive number, or indirectly as a negative number or positive or negative percentage representing a ratio of the total number of "should" clauses in this boolean junction.
Here is how each type of input is interpreted:
- Positive number
- The value is interpreted directly as the minimum number of "should" clauses that have to match.
- Negative number
- The absolute value is interpreted as the maximum number of "should" clauses that may not match: the absolute value is subtracted from the total number of "should" clauses.
- Positive percentage
- The value is interpreted as the minimum percentage of the total number of "should" clauses that have to match: the percentage is applied to the total number of "should" clauses, then rounded down.
- Negative percentage
- The absolute value is interpreted as the maximum percentage of the total number of "should" clauses that may not match: the absolute value of the percentage is applied to the total number of "should" clauses, then rounded down, then subtracted from the total number of "should" clauses.
In any case, if the computed minimum is 0 or less, or higher than the total number of "should" clauses, behavior is backend-specific (it may throw an exception, or produce unpredictable results, or fall back to some default behavior).
Examples:
// Example 1: at least 3 "should" clauses have to match booleanContext1.minimumShouldMatchNumber( 3 ); // Example 2: at most 2 "should" clauses may not match booleanContext2.minimumShouldMatchNumber( -2 ); // Example 3: at least 75% of "should" clauses have to match (rounded down) booleanContext3.minimumShouldMatchPercent( 75 ); // Example 4: at most 25% of "should" clauses may not match (rounded down) booleanContext4.minimumShouldMatchPercent( -25 );- Author:
- Emmanuel Bernard
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleanisEmpty()Deprecated.BooleanJunctionminimumShouldMatchNumber(int matchingClausesNumber)Deprecated.Sets the "minimumShouldMatch" constraint.BooleanJunctionminimumShouldMatchPercent(int matchingClausesPercent)Deprecated.Sets the "minimumShouldMatch" constraint.MustJunctionmust(Query query)Deprecated.The boolean query results must (or must not) match the subquery Call the .not() method to ensure results of the boolean query do NOT match the subquery.BooleanJunctionshould(Query query)Deprecated.The boolean query results should match the subquery-
Methods inherited from interface org.hibernate.search.query.dsl.QueryCustomization
boostedTo, filteredBy, withConstantScore
-
Methods inherited from interface org.hibernate.search.query.dsl.Termination
createQuery
-
-
-
-
Method Detail
-
should
BooleanJunction should(Query query)
Deprecated.The boolean query results should match the subquery- Parameters:
query- the query to match (nulls are ignored)- Returns:
- a
BooleanJunction
-
must
MustJunction must(Query query)
Deprecated.The boolean query results must (or must not) match the subquery Call the .not() method to ensure results of the boolean query do NOT match the subquery.- Parameters:
query- the query to match (nulls are ignored)- Returns:
- a
MustJunction
-
isEmpty
boolean isEmpty()
Deprecated.- Returns:
- true if no restrictions have been applied
-
minimumShouldMatchNumber
BooleanJunction minimumShouldMatchNumber(int matchingClausesNumber)
Deprecated.Sets the "minimumShouldMatch" constraint.- Parameters:
matchingClausesNumber- A definition of the number of "should" clauses that have to match. If positive, it is the number of clauses that have to match. See Definition of the minimum for details and possible values, in particular negative values.- Returns:
this, for method chaining.
-
minimumShouldMatchPercent
BooleanJunction minimumShouldMatchPercent(int matchingClausesPercent)
Deprecated.Sets the "minimumShouldMatch" constraint.- Parameters:
matchingClausesPercent- A definition of the number of "should" clauses that have to match, as a percentage. If positive, it is the percentage of the total number of "should" clauses that have to match. See Definition of the minimum for details and possible values, in particular negative values.- Returns:
this, for method chaining.
-
-