mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
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>
This commit is contained in:
committed by
Steve Sakoman
parent
cb43809aa3
commit
4ee43d7d68
@@ -171,13 +171,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);
|
||||
}
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user