Query pulling back unnecessary objects when embedded object gets updated and resulting in performance issue

Description

We have been having serious performance issues caused by updating fields in an embedded object. Specifically, we are using a class structure where "Account" is embedded in "User" is embedded in "Lesson", both of these associations being marked with the "@IndexedEmbedded(includePaths {**********})" notation on the owner side, with "@ContainedIn" marking the owned side. Paths specified are only one level deep and do not point to the described associations. When trying to update a field in "Account", Hibernate Search is making inefficient and unnecessary database queries:

1. Pulling back unnecessary objects
When updating an account, Hibernate Search tries to pull back both Users and Lessons, even though no change occurs in any fields accessible by Lesson(example Query 1 in attachments).

2. Inefficient Query
Hibernate Search gets user from account and then gets account from user (Query 2 in attachments).

We have tried several permutations of "includePaths" and "depth =" specifications, none of which have solved the issue.

Environment

4.4.4.Final, Mysql

Activity

Show:
Adrian Meredith
October 30, 2014, 12:03 PM

To my knowledge this is correct behaviour?
When updating shared fields the index has to update the entire document for every document that uses that shared field. Lucene cannot do index updates, what its really doing is a delete and add. Its the presence of the @ContainedIn annotation that informs lucene to reindex the parent object.

ylang
October 31, 2014, 6:28 PM

Hi Adrian,

Thank you for replying. Your comment is very helpful. But I think lesson shouldn't be re-indexed when account gets updated, because lesson is the parent of account's parent object and I use "includePaths" for "@IndexedEmbedded".

Assignee

Unassigned

Reporter

ylang

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Time tracking

12h

Components

Fix versions

Affects versions

Priority

Major
Configure