As users we don't want to reindex all documents of a template with any change because it's a waste of time and resources.
Changes to a template that SHOULD NOT trigger a reindex:
Changes to a template that SHOULD trigger a reindex:
By default there should be a reindex.
Issue reported on #2783
Also, I think there should not be a reindex when a new template is created. Am I right? @konzz @RafaPolit
@grafitto that particular case is not very relevant since upon template creation there are no entities and the reindex will be super quick. So just do it as it serves better for your current flow but do not condition your solution to this case.
I have 2 Ideas on how we can go about this:
{
// template details
...
reindexMetadata: {
color: true, // true if color has been changes, false/undefined otherwise
...
properties: [
{
label: true,
...
}
]
}
}
with reindexMetadata the server will be able to know whether to reindex or not.
(I prefer the second one because I think it would be easier to build on it in future and also maintain)
What do you think? @txau @konzz @RafaPolit @fnocetti
@grafitto second options seems more robust to me. It can be fine-tuned to track whether a change has to trigger the re-index or not. I don't see an automatic comparison here, like a diff, but rather a detailed checklist.
It also makes sense to only check for changes that need to trigger the re-index, at the first condition found there is no need to keep checking since the full re-index needs to be performed.
@konzz I have my doubts regarding the "delete a property" condition. Didn't we already implement re-index only if there was a name collision when creating/renaming another property? So:
I understand for the sake of simplicity to just do the re-index upon deletion, but since they are expensive maybe we want this granularity?
@grafitto second options seems more robust to me. It can be fine-tuned to track whether a change has to trigger the re-index or not. I don't see an automatic comparison here, like a diff, but rather a detailed checklist.
It also makes sense to only check for changes that need to trigger the re-index, at the first condition found there is no need to keep checking since the full re-index needs to be performed.
Okay. working on it
@konzz I have my doubts regarding the "delete a property" condition. Didn't we already implement re-index only if there was a name collision when creating/renaming another property? So:
I don't know if there is a confusion here. We have two types of reindex. A full-site reindex (that is only triggered when mappings change) and we have a reindex per-template: entities that belong to a template. Those entities should be reindexed upon deletion, upon many changes. Still, if you just flag for "show in cards" that shouldn't trigger the template-based reindex.
@RafaPolit yeah, I'm well aware of that. AFAIK you can ignore a property deletion from a template and you don't need to re-index UNLESS you try to create that property again with different mapping type.
No, I don't think so. Because those results will still show in full text searches, for example. You need to reindex after deletion.
@RafaPolit Ok, for the sake of simplicity we can reindex after deletion.
Should there be reindexing when a common property Priority sorting has been changed?
@grafitto it doesn't need to reindex when priority sorting changes.