Copy to ClipboardCopied!Toggle word wrapToggle overflow
This query API simplifies the way queries are written by not exposing the user to the low level details of constructing Lucene query objects. It also has the benefit of being available to remote Hot Rod clients.
The following example shows how to write a query for the Book entity.
Example 6.3. Querying the Book Entity
import org.infinispan.query.dsl.*;
// get the search manager from the cache, as in previous examples:
SearchManager searchManager = org.infinispan.query.Search.getSearchManager(cache);
// get the DSL query factory, to be used for constructing the Query object:
QueryFactory qf = searchManager.getQueryFactory();
// create a query for all the books that have a title which contains the word "engine":
org.infinispan.query.dsl.Query query = qf.from(Book.class)
.having("title").like("%engine%")
.toBuilder().build();
// get the results:List<Book> list = query.list();
import org.infinispan.query.dsl.*;
// get the search manager from the cache, as in previous examples:
SearchManager searchManager = org.infinispan.query.Search.getSearchManager(cache);
// get the DSL query factory, to be used for constructing the Query object:
QueryFactory qf = searchManager.getQueryFactory();
// create a query for all the books that have a title which contains the word "engine":
org.infinispan.query.dsl.Query query = qf.from(Book.class)
.having("title").like("%engine%")
.toBuilder().build();
// get the results:List<Book> list = query.list();
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.
Rendiamo l’open source più inclusivo
Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.
Informazioni su Red Hat
Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.