While looking through our entity tracking code just now, I realized that we actually never check the entity's language against the datasource settings before it is added to the tracker. This is mitigated by the fact that, as far as I can see, the entity (resp., the "undesired" translation in question) would still never actually be indexed, even if it's in the tracker. Even better, as soon as indexing is attempted for the item (which would be "right away" if "Index items immediately" is enabled) the code in \Drupal\search_api\Entity\Index::loadItemsMultiple() would recognize it as unloadable by the datasource and remove it from tracking again.

So, it's not actually a large problem, I think, but still not very clean and should be fixed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drunken monkey created an issue. See original summary.

drunken monkey’s picture

These two patches should demonstrate both the bug itself and that it's not a big problem.

PS: Oops, didn't mean to include those search_api.module changes, those were just meant to be included in the fix, to also make the documentation clearer there a bit.

The last submitted patch, 2: 2886978-2--disabled_languages_tracking.patch, failed testing. View results

drunken monkey’s picture

Status: Needs review » Needs work

The last submitted patch, 4: 2886978-4--disabled_languages_tracking.patch, failed testing. View results

drunken monkey’s picture

Ah, of course, the config key doesn't exist if the entity type isn't translatable.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Test looks solid, as does the code. Great work!

  • drunken monkey committed e8fb0c1 on 8.x-1.x
    Issue #2886978 by drunken monkey: Fixed tracking of entities in disabled...
drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Good to hear, thanks for your feedback!
Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.