diff --git a/CHANGES b/CHANGES index 6f4b321ef..c7d8e4786 100644 --- a/CHANGES +++ b/CHANGES @@ -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 -------- diff --git a/sphinx/themes/basic/static/searchtools.js b/sphinx/themes/basic/static/searchtools.js index d462f76e2..e15d80036 100644 --- a/sphinx/themes/basic/static/searchtools.js +++ b/sphinx/themes/basic/static/searchtools.js @@ -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++) {