我正在使用以下代码使用 hibernate-search 进行搜索。但这标记了搜索查询并执行OR 搜索,而我想做AND 搜索。我怎么做?
FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(em);
String searchQuery = "test query";
QueryBuilder qb = fullTextEntityManager.getSearchFactory().buildQueryBuilder().forEntity(Customer.class).get();
TermMatchingContext onFields = qb.keyword().onFields("customer.name","customer.shortDescription","customer.longDescription");
org.apache.lucene.search.Query query = onFields.matching(searchQuery).createQuery();
FullTextQuery persistenceQuery = fullTextEntityManager.createFullTextQuery(query, Customer.class);
List<Customization> result = persistenceQuery.getResultList();