Hello,
I have a class called Document :
Code:
@Indexed
public class Document {
@DocumentId
private Integer id;
@Field(index=Index.TOKENIZED, store=Store.YES)
private String titre;
// getters and setters
}
and a class called Entite which include a list of Document :
Code:
@Indexed
public class Entite
{
@DocumentId
private Integer id;
@Field(index=Index.TOKENIZED, store=Store.YES)
private String resume;
@ContainedIn
private List documents;
// getters and setters
}
and I want to have all "Entite" in which there is one "Document" which have titre=something.
I tried that :
Code:
FullTextSession fullTextSession = Search.createFullTextSession(s);
QueryParser parser = new QueryParser("title", new StopAnalyzer());
String requete = "titre:something";
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();
while(i.hasNext())
{
System.out.println("Objet trouve : "+i.next());
}
but it found nothing. And if I remove "Entite.class" restriction, there are "Document" results but not "Entite" ...
Thank you.