Class EmailAddress embeds via the Hibernate mapping file the class ShortName
Code:
@Indexed
public class EmailAddress {
@DocumentId
private long id;
private ShortName address;
Code:
public class ShortName {
@Field(index = Index.TOKENIZED, store = Store.NO)
private String value;
Code:
FullTextSession fullTextSession = Search.createFullTextSession(this.getSession());
MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[] { "address", "address.value" }, new StandardAnalyzer());
org.apache.lucene.search.Query query = null;
try {
query = parser.parse(searchTerm);
} catch (ParseException e) {
e.printStackTrace();
}
org.hibernate.Query hibQuery = fullTextSession.createFullTextQuery(query, EmailAddress.class);
List<EmailAddress> result = hibQuery.list();
Unfortunately the search does not result anything! How do I tell Hibernate search that I am using a component (embedded class). What is the notation for the fields for the MultiFieldQueryParser?