Hello, it's me again
Now, my problem is that I have duplicate results.
This is my code :
Code:
Session s = getSessionActuelle();
FullTextSession fullTextSession = Search.createFullTextSession(s);
QueryParser parser = new QueryParser("title", new StopAnalyzer());
String requete = "titre:enti*";
org.apache.lucene.search.Query luceneQuery = null;
try {
luceneQuery = parser.parse(requete);
} catch (ParseException e) {
e.printStackTrace();
}
org.hibernate.Query fullTextQuery = fullTextSession.createFullTextQuery(luceneQuery,Entite.class);
List result = (fullTextQuery).list(); //return a list of managed objects
Iterator i = result.iterator();
Entite entite1 = (Entite) i.next();
Entite entite2 = (Entite) i.next();
System.out.println(entite1 == entite2);
And the result is "true".
I know how I can remove duplicate Objects but I think it's not the solution :
Code:
Set setItems = new LinkedHashSet(resultList);
list.clear();
list.addAll(setItems);
Thank you