Incorrect "Display for searches" config field behavior

Created on 14 May 2024, 6 months ago
Updated 19 May 2024, 6 months ago

Problem/Motivation

We have incorrect behavior for the "Display for searches" config field.
We can select "For all except the selected" or "Only for the selected" variant, but in some cases we have an incorrect behavior according to the code.
Due to the issue, we got "Two matching searches on index %index for saved search block." errors in watchdog.

Steps to reproduce

  1. Prepare a page with 2 (or more) views for the Search API Index, 1 of the view should support Saved Searches functionality.
  2. Select "For all except the selected" option in the "Display for searches" field.
  3. For sure, you need to select not needed views (or views displays) to exclude support Saved Searches functionality, otherwise you'll have "Two matching searches on index ..." in watchdog.
  4. Check the page, we'll have error in the watchdog

Proposed resolution

Fix via a patch.

🐛 Bug report
Status

Postponed: needs info

Version

1.0

Component

Code

Created by

🇺🇦Ukraine tibezh

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

Merge Requests

Comments & Activities

  • Issue created by @tibezh
  • Issue was unassigned.
  • Status changed to Needs review 6 months ago
  • 🇺🇦Ukraine tibezh

    Here a patch.

  • 🇦🇹Austria drunken monkey Vienna, Austria

    Thanks for reporting this issue.
    However, I can’t reproduce the problem. I put two search views on the same page (one page and one block display), add a “Save search” bock. I get the warning that there are two matching searches on the page. When I select one of the displays in the Saved Searches settings (keeping it at “For all except the selected”), the warning vanishes. (Same if I do it the other way round and use “Only for the selected”.)

    Moreover, I don’t really see the change in the code, except that it’s now more verbose. (Whether that’s good or bad is a different discussion.)
    Can you provide the variable values for which the old and the new code behave differently?

  • Status changed to Postponed: needs info 6 months ago
  • 🇦🇹Austria drunken monkey Vienna, Austria
Production build 0.71.5 2024