From 21972a122b9f95b3aaa208a3be16fb12d57d38d1 Mon Sep 17 00:00:00 2001 From: Mohamed Lamine LALMI Date: Fri, 2 Jun 2023 18:06:11 +0000 Subject: [PATCH] [FIX] website: Handle matching words with point or slash Fix an issue where products with internal references containing point or slash were not recognized as direct matches in the website searchbar. Instead, fuzzy search was used to find similar words. This commit addresses the problem by fixing the regular expression used for matching words in Odoo's search functionality. X-original-commit: dee84ff3b0ec56149780e6eefb8724f954918fd1 Part-of: odoo/odoo#124211 --- addons/website/models/website.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 59aeeaeba4a..a4c6c862657 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -1661,7 +1661,7 @@ class Website(models.Model): :param limit: maximum number of records fetched per model to build the word list :return: yields words """ - match_pattern = r'[\w-]{%s,}' % min(4, len(search) - 3) + match_pattern = r'[\w./-]{%s,}' % min(4, len(search) - 3) similarity_threshold = 0.3 lang = self.env.lang or 'en_US' for search_detail in search_details: @@ -1771,7 +1771,7 @@ class Website(models.Model): :param limit: maximum number of records fetched per model to build the word list :return: yields words """ - match_pattern = r'[\w-]{%s,}' % min(4, len(search) - 3) + match_pattern = r'[\w./-]{%s,}' % min(4, len(search) - 3) first = escape_psql(search[0]) for search_detail in search_details: model_name, fields = search_detail['model'], search_detail['search_fields']