Change in searchable property can trigger updating whole graph of searchable entities
I was debugging a slow member-add operation, which took 10+sec. As soon as I removed the embedded search field
Member.person
, the action was instant again.It turns out that reindexing the
Submitted by Elmer van Chastelet on 9 December 2016 at 14:30Member
instance, will also trigger a reindex of thePerson
entity (member.person
) , even when thePerson
has no embedded search field (memberships
is not searchable). The reindex ofPerson
then triggers a reindex of all entities that havePerson
as embedded searchfield, i.e. allMember
entities that have this person set asmember.person
. So it’s likely that the 1495 reindexedMember
-instances cause the action to be this slow. Hopefully this is a configuration issue or something we can overcome.
Issue Log
Maybe it’s caused by the way WebDSL changes a collection. If a member is added to
Person.memberships
, and it creates a whole new collection that is set into this property, then yes, it will trigger a reindex of all theMember
entities inPerson.memberships
. Something to investigate.
After some more debugging I see that HSearch will reindex the whole “index-graph”, whenever it indexes an embedded entity.
For instance, when I make a change in the searchable propertyPerson.fullname
, thatPerson
instance will be reindexed. ThisPerson
instance is also embedded in other searchable entities, like inConferenceEdition.editors
(you can search conference editions for which a person is editor). The generated code has the@ContainedIn
annotation on the inverse relation of such embedded search field, in this case:Person.editorOf
(type ofSet<ConferenceEdition>
). A change to a searchable property ofPerson
will then trigger a reindexation of all instances inPerson.editorOf
. Nothing special here, and this is how it should work.However, as multiple
ConferenceEdition
instances will also be reindexed, the story repeats itself at this level, even whenConferenceEdition
is only indexed up to depth level 1. And this is wrong, because we know that entities havingConferenceEdition
as embedded search field, will only index the simple properties ofConferenceEdition
(because of depth=1), and thus there is no change in indexed fields. Only the fields at level 2 are changed (ConferenceEdition.editors.fullname
).In numbers, when I change my full name (and I’m editor of many conference editions), it reindexes many unrelated entities, causing this change to be extremely inefficient.
Member - 2242
Person - 1
ConferenceEdition - 81
Track - 96
Event - 1017
ProgramSlot - 1029
Log in to post comments