firefly
firefly

Reputation: 252

Index Multiple Entities using Hibernate Search

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 the groups, pages etc with the given query string.

Upvotes: 1

Views: 2827

Answers (2)

Niek Tax
Niek Tax

Reputation: 841

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

Upvotes: 5

RandomMooCow
RandomMooCow

Reputation: 732

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);.

Upvotes: 2

Related Questions