/** * Add a "must not" clause based on an almost-built {@link SearchPredicate}. * <p> * Documents matching the "must not" clause won't match the "match all" predicate. * * @param terminalContext The terminal context allowing to retrieve a {@link SearchPredicate}. * @return A context allowing to get the resulting predicate. */ default MatchAllPredicateContext except(SearchPredicateTerminalContext terminalContext) { return except( terminalContext.toPredicate() ); } /*
public SearchPredicate extendedPredicate(String fieldName, String value) { return delegate.match().onField( fieldName ).matching( value ).toPredicate(); } }
/** * Set the inner predicate to an almost-built {@link SearchPredicate}. * <p> * Matching documents are those for which at least one element of the nested object field * matches the inner predicate. * * @param terminalContext The terminal context allowing to retrieve a {@link SearchPredicate}. * @return A context allowing to get the resulting predicate. */ default SearchPredicateTerminalContext nest(SearchPredicateTerminalContext terminalContext) { return nest( terminalContext.toPredicate() ); }
/** * Add a default <a href="MinimumShouldMatchContext.html#minimumshouldmatch">"minimumShouldMatch" constraint</a>. * * @param 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 <a href="MinimumShouldMatchContext.html#minimumshouldmatch-minimum">Definition of the minimum</a> * for details and possible values, in particular negative values. * @return {@code this}, for method chaining. */ default BooleanJunctionPredicateContext minimumShouldMatchNumber(int matchingClausesNumber) { return minimumShouldMatch() .ifMoreThan( 0 ).thenRequireNumber( matchingClausesNumber ) .end(); }
/** * Add a default <a href="MinimumShouldMatchContext.html#minimumshouldmatch">"minimumShouldMatch" constraint</a>. * * @param 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 <a href="MinimumShouldMatchContext.html#minimumshouldmatch-minimum">Definition of the minimum</a> * for details and possible values, in particular negative values. * @return {@code this}, for method chaining. */ default BooleanJunctionPredicateContext minimumShouldMatchPercent(int matchingClausesPercent) { return minimumShouldMatch() .ifMoreThan( 0 ).thenRequirePercent( matchingClausesPercent ) .end(); }
/** * Add a <a href="#must">"must" clause</a> based on an almost-built {@link SearchPredicate}. * * @param terminalContext The terminal context allowing to retrieve a {@link SearchPredicate}. * @return {@code this}, for method chaining. */ default BooleanJunctionPredicateContext must(SearchPredicateTerminalContext terminalContext) { return must( terminalContext.toPredicate() ); }
@Test public void rangeQueryFromTo() { SearchQuery<DocumentReference> query = rangeQuery( f -> f.range().onField( FIELD_PATH ).from( Boolean.FALSE ).to( Boolean.FALSE ).toPredicate() ); assertHasHitsWithBooleanProperties( query, Boolean.FALSE, Boolean.FALSE ); }
/** * Add a <a href="#should">"should" clause</a> based on an almost-built {@link SearchPredicate}. * * @param terminalContext The terminal context allowing to retrieve a {@link SearchPredicate}. * @return {@code this}, for method chaining. */ default BooleanJunctionPredicateContext should(SearchPredicateTerminalContext terminalContext) { return should( terminalContext.toPredicate() ); }
/** * Add a <a href="#mustnot">"must not" clause</a> based on an almost-built {@link SearchPredicate}. * * @param terminalContext The terminal context allowing to retrieve a {@link SearchPredicate}. * @return {@code this}, for method chaining. */ default BooleanJunctionPredicateContext mustNot(SearchPredicateTerminalContext terminalContext) { return mustNot( terminalContext.toPredicate() ); }
/** * Add a <a href="#filter">"filter" clause</a> based on an almost-built {@link SearchPredicate}. * * @param terminalContext The terminal context allowing to retrieve a {@link SearchPredicate}. * @return {@code this}, for method chaining. */ default BooleanJunctionPredicateContext filter(SearchPredicateTerminalContext terminalContext) { return filter( terminalContext.toPredicate() ); }
@Test public void rangeQueryAbove() { SearchQuery<DocumentReference> query = rangeQuery( f -> f.range().onField( FIELD_PATH ).above( Boolean.TRUE ).toPredicate() ); assertHasHitsWithBooleanProperties( query, Boolean.TRUE, Boolean.TRUE ); }
@Test public void rangeQueryBelow() { SearchQuery<DocumentReference> query = rangeQuery( f -> f.range().onField( FIELD_PATH ).below( Boolean.FALSE ).toPredicate() ); assertHasHitsWithBooleanProperties( query, Boolean.FALSE, Boolean.FALSE ); }
/** * Add a default <a href="MinimumShouldMatchContext.html#minimumshouldmatch">"minimumShouldMatch" constraint</a>. * * @param 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 <a href="MinimumShouldMatchContext.html#minimumshouldmatch-minimum">Definition of the minimum</a> * for details and possible values, in particular negative values. * @return {@code this}, for method chaining. */ default BooleanJunctionPredicateContext minimumShouldMatchNumber(int matchingClausesNumber) { return minimumShouldMatch() .ifMoreThan( 0 ).thenRequireNumber( matchingClausesNumber ) .end(); }
/** * Add a default <a href="MinimumShouldMatchContext.html#minimumshouldmatch">"minimumShouldMatch" constraint</a>. * * @param 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 <a href="MinimumShouldMatchContext.html#minimumshouldmatch-minimum">Definition of the minimum</a> * for details and possible values, in particular negative values. * @return {@code this}, for method chaining. */ default BooleanJunctionPredicateContext minimumShouldMatchPercent(int matchingClausesPercent) { return minimumShouldMatch() .ifMoreThan( 0 ).thenRequirePercent( matchingClausesPercent ) .end(); }
/** * Set the inner predicate to an almost-built {@link SearchPredicate}. * <p> * Matching documents are those for which at least one element of the nested object field * matches the inner predicate. * * @param terminalContext The terminal context allowing to retrieve a {@link SearchPredicate}. * @return A context allowing to get the resulting predicate. */ default SearchPredicateTerminalContext nest(SearchPredicateTerminalContext terminalContext) { return nest( terminalContext.toPredicate() ); }
/** * Add a <a href="#must">"must" clause</a> based on an almost-built {@link SearchPredicate}. * * @param terminalContext The terminal context allowing to retrieve a {@link SearchPredicate}. * @return {@code this}, for method chaining. */ default BooleanJunctionPredicateContext must(SearchPredicateTerminalContext terminalContext) { return must( terminalContext.toPredicate() ); }
/** * Add a "must not" clause based on an almost-built {@link SearchPredicate}. * <p> * Documents matching the "must not" clause won't match the "match all" predicate. * * @param terminalContext The terminal context allowing to retrieve a {@link SearchPredicate}. * @return A context allowing to get the resulting predicate. */ default MatchAllPredicateContext except(SearchPredicateTerminalContext terminalContext) { return except( terminalContext.toPredicate() ); } /*
/** * Add a <a href="#should">"should" clause</a> based on an almost-built {@link SearchPredicate}. * * @param terminalContext The terminal context allowing to retrieve a {@link SearchPredicate}. * @return {@code this}, for method chaining. */ default BooleanJunctionPredicateContext should(SearchPredicateTerminalContext terminalContext) { return should( terminalContext.toPredicate() ); }
/** * Add a <a href="#mustnot">"must not" clause</a> based on an almost-built {@link SearchPredicate}. * * @param terminalContext The terminal context allowing to retrieve a {@link SearchPredicate}. * @return {@code this}, for method chaining. */ default BooleanJunctionPredicateContext mustNot(SearchPredicateTerminalContext terminalContext) { return mustNot( terminalContext.toPredicate() ); }
/** * Add a <a href="#filter">"filter" clause</a> based on an almost-built {@link SearchPredicate}. * * @param terminalContext The terminal context allowing to retrieve a {@link SearchPredicate}. * @return {@code this}, for method chaining. */ default BooleanJunctionPredicateContext filter(SearchPredicateTerminalContext terminalContext) { return filter( terminalContext.toPredicate() ); }