Skip to content

Fix #6165: Improve global search relevance and add exact-field operators#6187

Merged
xet7 merged 1 commit intowekan:mainfrom
KhaoulaMaleh:bugfix/6165-card-search-results
Mar 16, 2026
Merged

Fix #6165: Improve global search relevance and add exact-field operators#6187
xet7 merged 1 commit intowekan:mainfrom
KhaoulaMaleh:bugfix/6165-card-search-results

Conversation

@KhaoulaMaleh
Copy link
Contributor

Description

This PR addresses issue #6165 where the global card search was returning confusing or irrelevant results because it matched keywords in obscure fields (like comments and attachments) and treated them with the same weight as exact title matches.

To fix this, two major enhancements have been added:

Relevance Ranking on Global Search: Text searches now assign a _score to matching cards and sort them by relevance before serving them to the client. Matches in the Card Title are scored highest, followed by the Description, and then Custom Fields. This ensures the most visually relevant cards always appear first.

Precise Search Operators: Users can now search specific fields explicitly to narrow down their search and bypass global searching.

How to Test

Navigate to the global search bar.
Search for a generic keyword that exists in deeply nested comments/attachments as well as the title of a card.
Verify: The card with the keyword in the title is ordered visibly earlier/first in the results.
Try combining literal operators to narrow down matches:
title:"Exact Title Text"
description:keyword
attachment:filename
customfield:value

Fixes

Closes #6165

@xet7 xet7 merged commit 9a63197 into wekan:main Mar 16, 2026
5 checks passed
@xet7
Copy link
Member

xet7 commented Mar 16, 2026

@KhaoulaMaleh

What is point here with changes to translations?

@KhaoulaMaleh
Copy link
Contributor Author

@xet7
The changes to the translation file are actually mechanically required for the new search operators to work
In Wekan's search architecture, the query parser inside [config/query-classes.js] maps what the user types in the search bar back to internal constants by relying on TAPi18n.
It essentially says: "Check if the word the user typed matches the translated value of operator-title, operator-description, etc."
If we don't add those keys to the [en.i18n.json] file:

  1. TAPi18n will fail to find a translation for operator-title.
  2. The parser won't recognize that typing title:something is an operator.
  3. The search will treat title:something as just a normal text string instead of filtering by the title.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Card search returns irrelevant results and non-related cards

2 participants