Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing a node from the index does not remove the variants in all case #285

Open
dfeyer opened this issue Nov 7, 2018 · 1 comment
Open

Comments

@dfeyer
Copy link
Contributor

dfeyer commented Nov 7, 2018

Given I have a node in dimension A, on a website with 2 dimanesions A and B and my node does not exist in dimension B

During indexing we create two document in the index one for dimension A and one for dimension B.

If I remove the node in dimension A, the document in this dimension is removed correctly but the one in the dimension B. It's not a big issue, because the document of the Elastic query are filtered and only existing document in the CR are returned.

But it's not clean ;) and in some case it can have an impact on the query algorythm, because Elastic use data that are not in sync with the CR.

Affected version: all

Possible solution

It's a bit complexe, in my case it's easy, we can remove all variants (because node does not exist in dimension B).

But it's a valid case, to have the node in both A and B dimensions, but only removing the one in dimension A (in this case the current behaviour is correct.

So we have two scenario:

  1. Node existe in all dimensions and remove works as expected
  2. Node exists only in a subset off all dimensions in this case the content of the index is out of sync as soon as we delete the node in one or some dimensions (but not all)

How to detect those two scenario ?

@dfeyer
Copy link
Contributor Author

dfeyer commented Nov 7, 2018

One possible solution:

  • Remove the node
  • Iterate over all existing variants (only existing one), remove docs in Elastic
  • Iterate over ContentDimensionsPreset, then:
    • remove all doc from the index
    • check if node exist in the CR, reindex those nodes only

Needs to modularize a bit the NodeIndexer::indexNode to extract the closure to handle single variant indexing, but I think that should works.

And by the way the indexed content of a variant node, can depends on the other variants (contenu shine throw, so refreshing the index is maybe a good idea here.

@dfeyer dfeyer changed the title Removing a node from the index does not remove the variants Removing a node from the index does not remove the variants in all case Nov 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant