summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Jörns <ejo@pengutronix.de>2025-07-03 12:23:01 +0200
committerSteve Sakoman <steve@sakoman.com>2025-07-14 08:37:40 -0700
commit4ee43d7d686836b27d4f6c075915b7a2e14db997 (patch)
treebdf8428947f4008029b4b9740a23cbcb703414dd
parentcb43809aa3cc979bbc08f9f8b3f5296009be95a9 (diff)
downloadpoky-4ee43d7d686836b27d4f6c075915b7a2e14db997.tar.gz
conf.py: improve SearchEnglish to handle terms with dots
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: 02cc810c17e37563a206629d703dc21fc4280cbf) Signed-off-by: Enrico Jörns <ejo@pengutronix.de> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> (cherry picked from commit 80084a4cabdf7f61c7e93eda8ddbd5bc7d54e041) Signed-off-by: Antonin Godard <antonin.godard@bootlin.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--documentation/conf.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/documentation/conf.py b/documentation/conf.py
index 33c6fa027f..901d2666a3 100644
--- a/documentation/conf.py
+++ b/documentation/conf.py
@@ -171,13 +171,13 @@ from sphinx.search import SearchEnglish
171from sphinx.search import languages 171from sphinx.search import languages
172class DashFriendlySearchEnglish(SearchEnglish): 172class DashFriendlySearchEnglish(SearchEnglish):
173 173
174 # Accept words that can include hyphens 174 # Accept words that can include 'inner' hyphens or dots
175 _word_re = re.compile(r'[\w\-]+') 175 _word_re = re.compile(r'[\w]+(?:[\.\-][\w]+)*')
176 176
177 js_splitter_code = r""" 177 js_splitter_code = r"""
178function splitQuery(query) { 178function splitQuery(query) {
179 return query 179 return query
180 .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}-]+/gu) 180 .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}\-\.]+/gu)
181 .filter(term => term.length > 0); 181 .filter(term => term.length > 0);
182} 182}
183""" 183"""