Allow to opt-out index tracker reset on locale update

Created on 13 March 2025, about 1 month ago

Problem/Motivation

As part of my build process, I run locale updates to ensure Drupal core and contrib's translations are up to date with community ones. The problem is that even if those translations have no impact on my search indexes, their tracker are reset once any translation has been updated. This is an issue because it costs a lot of processing power to reindex everything.

Steps to reproduce

  1. On a multilingual website
  2. Ensure you have at least one item in one of your indexes
  3. Run drush locale:update or drush locale:import
  4. Your indexes trackers have now been reset

Proposed resolution

Allow to configure indexes so their trackers are not reset when locales are updated.

✨ Feature request
Status

Active

Version

1.0

Component

General code

Created by

🇫🇷France duaelfr Montpellier, France

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @duaelfr
  • 🇫🇷France duaelfr Montpellier, France
  • 🇫🇷France duaelfr Montpellier, France

    Note: the issue doesn't happen when manually updating interface or config translations

  • 🇫🇷France duaelfr Montpellier, France

    @maintainers: Hi! I'm willing to provide a fix but I'd need a bit of guidance because I can't figure out where this is happening. Would you help me, please?

  • 🇦🇹Austria drunken monkey Vienna, Austria

    Thanks for reporting this issue and sorry for the delay!
    However, I’m afraid I cannot reproduce this problem:

    $ drush sapi-s
     --------------------- ----------------------- ------------ --------- ------- 
      ID                    Name                    % Complete   Indexed   Total  
     --------------------- ----------------------- ------------ --------- ------- 
      default_index         Default content index   100%         233       233    
     --------------------- ----------------------- ------------ --------- -------
    $ drush locale:update
    …
    $ drush sapi-s
     --------------------- ----------------------- ------------ --------- ------- 
      ID                    Name                    % Complete   Indexed   Total  
     --------------------- ----------------------- ------------ --------- ------- 
      default_index         Default content index   100%         233       233    
     --------------------- ----------------------- ------------ --------- -------
    

    Am I doing something wrong for reproducing? Otherwise it seems some custom code or third-party module is to blame for this issue. You’d have to track calls to the appropriate method(s) on \Drupal\search_api\Entity\Index (probably reindex(), clear() or rebuildTracker()) or the tracker plugin and log the backtrace to figure out where the call is coming from.

Production build 0.71.5 2024