Skip to content

Commit

Permalink
HSEARCH-4536 Document how to disable all flags with the simple query …
Browse files Browse the repository at this point in the history
…string predicate
  • Loading branch information
yrodiere committed Apr 8, 2022
1 parent 2fffa48 commit a966571
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Expand Up @@ -1101,6 +1101,16 @@ include::{sourcedir}/org/hibernate/search/documentation/search/predicate/Predica
----
====

If you wish, you can disable all syntax constructs:

.Matching a simple query string: disabling all syntax constructs
====
[source, JAVA, indent=0, subs="+callouts"]
----
include::{sourcedir}/org/hibernate/search/documentation/search/predicate/PredicateDslIT.java[tags=simpleQueryString-flags-none]
----
====

[[search-dsl-predicate-simpleQueryString-multiple-fields]]
=== Targeting multiple fields

Expand Down
Expand Up @@ -9,6 +9,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import javax.persistence.EntityManagerFactory;
Expand Down Expand Up @@ -690,6 +691,19 @@ public void simpleQueryString() {
.extracting( Book::getId )
.containsExactlyInAnyOrder( BOOK1_ID, BOOK3_ID );
} );

withinSearchSession( searchSession -> {
// tag::simpleQueryString-flags-none[]
List<Book> hits = searchSession.search( Book.class )
.where( f -> f.simpleQueryString().field( "title" )
.matching( "**robot**" )
.flags( Collections.emptySet() ) )
.fetchHits( 20 );
// end::simpleQueryString-flags-none[]
assertThat( hits )
.extracting( Book::getId )
.containsExactlyInAnyOrder( BOOK1_ID, BOOK3_ID );
} );
}

@Test
Expand Down

0 comments on commit a966571

Please sign in to comment.