emmanuel wrote:
To your second question. It will work if you @Indexed both A and B.
you will be able to find As by name.
I really don't know how to write the index label in both of A and B and how to write the search sentense in this case.
If I index A and B like this:
@Indexed(index="B")
public class B{
private String id;
@Field(store=Store.YES,index=Index.TOKENIZED)
public String getId(){
this.id
}
}
@Indexed(index="A")
public class A extends B{
private String name;
@Field(store=Store.YES,index=Index.TOKENIZED)
public String getName(){
this.name
}
}
And the search like this:
QueryParser queryParser=new QueryParser("
id",new StandardAnalyzer());
org.apache.lucene.search.Query query=queryParser.parse("
id:5*");
Search.createFullTextSession(getSessionFactory().getCurrentSession()).createFullTextQuery(query,
A.class).list();
I create two index directories, can Hibernate Search know the relationship of these two indexes?
How to change the code to get the purpose I want? Thanks!