Search in sources :

Example 1 with FullTextEntityManager

use of org.hibernate.search.jpa.FullTextEntityManager in project wildfly by wildfly.

the class SearchBean method findByKeyword.

public List<Book> findByKeyword(String keyword) {
    FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(em);
    TermQuery termQuery = new TermQuery(new Term("title", keyword));
    FullTextQuery fullTextQuery = fullTextEntityManager.createFullTextQuery(termQuery, Book.class);
    return fullTextQuery.getResultList();
}
Also used : TermQuery(org.apache.lucene.search.TermQuery) Term(org.apache.lucene.index.Term) FullTextQuery(org.hibernate.search.jpa.FullTextQuery) FullTextEntityManager(org.hibernate.search.jpa.FullTextEntityManager)

Aggregations

Term (org.apache.lucene.index.Term)1 TermQuery (org.apache.lucene.search.TermQuery)1 FullTextEntityManager (org.hibernate.search.jpa.FullTextEntityManager)1 FullTextQuery (org.hibernate.search.jpa.FullTextQuery)1