From 045c6b1669c11e44f4b14c8f44dc4f3458bb4fca Mon Sep 17 00:00:00 2001 From: Enrico Jörns Date: Thu, 3 Jul 2025 12:23:01 +0200 Subject: conf.py: improve SearchEnglish to handle terms with dots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While search queries already handled words with hyphens correctly, they did not do so for words with dots. To fix this, we - enhance the word tokenizer to treat both dots ('.') and hyphens ('-') as valid characters within words. (For robustness, explicitly exclude dots/hyphens at the start or end of a word from indexing.) - adjust query processing to avoid splitting on dots in search input This allows search queries to correctly match terms such as 'local.conf', 'site.conf', and similar ones now. Fixes: [YOCTO #14534] (From yocto-docs rev: 3f88cb85cca8f9128cfaab36882c4563457b03d9) Signed-off-by: Enrico Jörns Signed-off-by: Antonin Godard (cherry picked from commit 80084a4cabdf7f61c7e93eda8ddbd5bc7d54e041) Signed-off-by: Antonin Godard Signed-off-by: Steve Sakoman --- documentation/conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'documentation/conf.py') diff --git a/documentation/conf.py b/documentation/conf.py index 1eca8756ab..c07b6c4199 100644 --- a/documentation/conf.py +++ b/documentation/conf.py @@ -179,13 +179,13 @@ from sphinx.search import SearchEnglish from sphinx.search import languages class DashFriendlySearchEnglish(SearchEnglish): - # Accept words that can include hyphens - _word_re = re.compile(r'[\w\-]+') + # Accept words that can include 'inner' hyphens or dots + _word_re = re.compile(r'[\w]+(?:[\.\-][\w]+)*') js_splitter_code = r""" function splitQuery(query) { return query - .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}-]+/gu) + .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}\-\.]+/gu) .filter(term => term.length > 0); } """ -- cgit v1.2.3-54-g00ecf