Je viens de créer une recherche de texte intégral hibernate en utilisant hibernate-search-4.1.1.Final.jar et toutes les dépendances d'exécution. Il n'y a aucune erreur dans cette application. Mais ma requête Lucene ne contenant pas la requête DSL ne renvoie aucun résultat. Je veux dire ne renvoie aucune ligne dans la table. quelqu'un peut m'aider s'il vous plaît.Hibernate Recherche plein texte
Programme de recherche principal Ce code Java est utilisé pour effectuer une recherche de texte intégral en mode hibernation.
public class MainSearch {
public static void main(String args[]) {
Iterator iterator;
Session session = HibernateUtil.getSession();
// FullTextSession fullTextSession = Search.getFullTextSession(session);
FullTextSession fullTextSession = Search.getFullTextSession(session);
org.hibernate.Transaction tx = fullTextSession.beginTransaction();
// create native Lucene query unsing the query DSL
// alternatively you can write the Lucene query using the Lucene query
// parser
// or the Lucene programmatic API. The Hibernate Search DSL is
// recommended though
QueryBuilder qb = fullTextSession.getSearchFactory()
.buildQueryBuilder().forEntity(Book.class).get();
org.apache.lucene.search.Query query = qb.keyword()
.onFields("title", "subtitle", "authors.name").matching("cpp")
.createQuery();
// wrap Lucene query in a org.hibernate.Query
org.hibernate.Query hibQuery = fullTextSession.createFullTextQuery(
query, Book.class);
// execute search
List result = hibQuery.list();
iterator = result.iterator();
while (iterator.hasNext()) {
System.out.print(iterator.next() + " ");
}
System.out.println();
// Check list empty or not
if (result.isEmpty()) {
System.out.println("Linked list is empty");
}
tx.commit();
session.close();
}
}
http://stackoverflow.com/questions/9488094/ hibernate-mssql-fulltext-recherche-via-contient même problème résolu – user1817599