mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
add support for partial matches in js search
This commit is contained in:
parent
947e01436b
commit
50172f19f6
@ -391,6 +391,17 @@ var Search = {
|
||||
{files: terms[word], score: Scorer.term},
|
||||
{files: titleterms[word], score: Scorer.title}
|
||||
];
|
||||
// add support for partial matches
|
||||
for (var w in terms) {
|
||||
if ( w.match(word) ) {
|
||||
_o.push({files: terms[w], score: Scorer.term/2})
|
||||
}
|
||||
}
|
||||
for (var w in titleterms) {
|
||||
if (w.match(word)) {
|
||||
_o.push({files: titleterms[w], score: Scorer.title/2})
|
||||
}
|
||||
}
|
||||
|
||||
// no match but word was a required one
|
||||
if ($u.every(_o, function(o){return o.files === undefined;})) {
|
||||
|
Loading…
Reference in New Issue
Block a user