Incorrect Search API (tag-based) cached excerpt highlighting for subsequent search with a different term but same result items

Created on 9 June 2022, over 2 years ago
Updated 19 March 2024, 9 months ago

The highlight row cache not miss when using the Search API (tag-based) in views

  1. Create a views page base on search api
  2. Choose the Search API (tag-based) for the views
  3. Config search api highlight processor and add "Search: Excerpt" field to the view we added above
  4. Config text search for the views
  5. Test search function in the views page with keyword "test01", and the result highlight "test01" in each result row
  6. Now search "test02", check the result item which both have "test01" and "test02", we find that "test01" is highlight instead of "test02"

Proposed resolution

It seems like the code below in the src/Plugin/views/cache/SearchApiTagCache.php does not include all the ids it should include as the core/modules/views/src/Plugin/views/cache/CachePluginBase.php does

/**
   * {@inheritdoc}
   */
  public function getRowId(ResultRow $row) {
    return $row->search_api_id;
  }
🐛 Bug report
Status

Needs work

Version

1.23

Component

Views integration

Created by

🇨🇳China guaneagler

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024