Support for fetch joins in Hibernate search queries

Description

In Hibernate search, the related entities marked using @IndexedEmbedded are now getting lazy fetched which is causing unnecessary queries to be generated. It would be useful if fetch joins can be used for better performance.

Activity

Show:

Sanne Grinovero February 18, 2016 at 11:42 AM

Marking this out of date as I'm not sure if it was always possible, but it is now.

We could open a follow-up issue to make it an easier looking API, if someone comes with a concrete proposal.

Sanne Grinovero February 18, 2016 at 11:40 AM

For the record I've just reviewed a benchmark which does use the setCriteriaQuery like suggested by Emmanuel:

Query q = fts.getSearchFactory() .buildQueryBuilder() .forEntity(Book.class) .get() .keyword() .onField("authors.name") .matching("author" + authorId) .createQuery(); Criteria fetchAuthors = fts.createCriteria(Book.class).setFetchMode("authors", FetchMode.JOIN); List<Book> result = fts.createFullTextQuery(q, Book.class).setCriteriaQuery(fetchAuthors).list();

It works.

Emmanuel Bernard April 8, 2010 at 5:32 PM

Isn't it what FullTextQuery#setCriteriaQuery already provides?

Seema Richard February 15, 2009 at 4:50 PM

I would like to have the fetch join strategy supported for all entities related to the indexed entity and not just for the ones that are IndexedEmbedded.

Sanne Grinovero February 15, 2009 at 4:35 PM

Out of Date

Details

Assignee

Reporter

Components

Priority

Created February 15, 2009 at 4:20 PM
Updated February 18, 2016 at 11:42 AM
Resolved February 18, 2016 at 11:40 AM

Flag notifications