Two Full-text search fields on one indexed attachment field, fetch wrong results.

Created on 1 August 2024, 5 months ago
Updated 10 August 2024, 5 months ago

Problem/Motivation

I have created two full-text fields on one index. The first full-text field uses the "Contains any of these words" option, while the second uses the "Contains all of these words" option. I expected the combined query to function like [(City1 OR City2) AND (Talent1 AND Talent2)].

For example, when I search using only the first full-text field, I get 100 results. However, when I search using both full-text fields with the same search criteria, I receive more than 100 records.

🐛 Bug report
Status

Postponed: needs info

Version

1.0

Component

Views integration

Created by

🇮🇳India nitesh pawar

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

Comments & Activities

  • Issue created by @nitesh pawar
  • Status changed to Postponed: needs info 5 months ago
  • 🇦🇹Austria drunken monkey Vienna, Austria

    Unfortunately, our internal representation of search queries is not flexible enough to always reflect such more complex setups accurately. So while [(City1 OR City2) AND (Talent1 AND Talent2)] is definitely what should be happening, the generated query might easily look differently.
    (To be precise, the problem is that the search query object can just store a single set of search keywords and a single set of searched fields. Therefore, one of those two filters has to be represented as a condition instead of a fulltext search, and that way it isn’t possible to reflect the operator.)

    To see this, try enabling “Show the SQL query” in the view settings and then use the view’s Live Preview to see the generated search query. If you then post this here, I can explain what is happening and might even have a suggested solution.

    Although, I also have a suggested solution right away: You could use the “Search: Fulltext search” filter for the first field (with “Contains any of these words” operator) but for the second filter use the field directly (e.g., “Content datasource: Talent”). If you’re searching just a single field with “Contains all of these words” operator then it’s not necessary to use the “Search: Fulltext search” filter, and avoiding it might remove the difficulty the Views backend is running into when trying to combine the two competing sets of search keywords.

Production build 0.71.5 2024