Is it possible to Index multiple entities within same index using Hibernate Search ? I have 3 entities User, Category and Campaign. These entities are not related to each other.
I need to provide a functionality where user can search across these entities. Similar to facebook search or Quora search.
Eg: https://www.facebook.com/search.php?q=Stackoverflow will show all t开发者_C百科he groups, pages etc with the given query string.
I do realize that this is a rather old question, but I'll still post an answer to this question as it might some day still help someone.
Yes, it is possible. How you can do that is described here: http://docs.jboss.org/hibernate/search/4.2/reference/en-US/html_single/#section-sharing-indexes
It's not possible (AFAIK) to index multiple entities within the same index, though you can query multiple indexes at the same time using the FullTextSession.createFullTextQuery(Query, Class<?> ...)
method. In your case, the usage would be fullTextSession.createFullTextQuery(query, User.class, Category.class, Campaign.class);
.
精彩评论