Merge pull request #5979 from TimKam/4649-fix-search-for-filenames

The search function considers every page a "miss"/no match if the search contains a term with length <= 2;
This is problem when users search for filenames, identifiers, et cetera.
This PR changes the behavior to be more lenient in such cases: if an additional search term is of length <= 2, it is ignored (no longer a necessary condition for a match).
This commit is contained in:
Timotheus Kampik 2019-01-27 20:32:56 +01:00 committed by GitHub
commit 97d99f8302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -188,6 +188,8 @@ Bugs fixed
* HTML: Invalid HTML5 file is generated for a glossary having multiple terms for
one description (refs: #4611)
* QtHelp: OS dependent path separator is used in .qhp file
* HTML search: search always returns nothing when multiple search terms are
used and one term is shorter than three characters
Testing
--------

View File

@ -443,8 +443,12 @@ var Search = {
var valid = true;
// check if all requirements are matched
if (fileMap[file].length != searchterms.length)
continue;
var filteredTermCount = // as search terms with length < 3 are discarded: ignore
searchterms.filter(function(term){return term.length > 2}).length
if (
fileMap[file].length != searchterms.length &&
fileMap[file].length != filteredTermCount
) continue;
// ensure that none of the excluded terms is in the search result
for (i = 0; i < excluded.length; i++) {