6824 fix search js bug (#6844)

* #6824: Fix search logic (front end)

Prevent duplicate additions of terms to a file in ``fileMap``, document search fix in change log
This commit is contained in:
Timotheus Kampik 2019-11-20 21:13:54 +01:00 committed by GitHub
parent 4635727037
commit a0b0542218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -70,6 +70,9 @@ Bugs fixed
* #6813: An orphan warning is emitted for included document on Windows. Thanks
to @drillan
* #6850: Fix smartypants module calls re.sub() with wrong options
* #6824: HTML search: If a search term is partially matched in the title and
fully matched in a text paragraph on the same page, the search does not
include this match.
Testing
--------

View File

@ -424,7 +424,7 @@ var Search = {
for (j = 0; j < _files.length; j++) {
file = _files[j];
if (!(file in scoreMap))
scoreMap[file] = {}
scoreMap[file] = {};
scoreMap[file][word] = o.score;
}
});
@ -432,7 +432,7 @@ var Search = {
// create the mapping
for (j = 0; j < files.length; j++) {
file = files[j];
if (file in fileMap)
if (file in fileMap && fileMap[file].indexOf(word) === -1)
fileMap[file].push(word);
else
fileMap[file] = [word];