From e8fe8584e468d9eee33b9d640bae27b6a8b0e605 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 4 Apr 2010 18:40:06 +0200 Subject: [PATCH] #353: Strip leading and trailing whitespace when extracting search words in the search function. --- CHANGES | 3 +++ sphinx/themes/basic/static/searchtools.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/CHANGES b/CHANGES index cd8410d3b..2a09999d9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ Release 0.6.6 (in development) ============================== +* #353: Strip leading and trailing whitespace when extracting + search words in the search function. + Release 0.6.5 (Mar 01, 2010) ============================ diff --git a/sphinx/themes/basic/static/searchtools.js b/sphinx/themes/basic/static/searchtools.js index e0226258a..71e175d27 100644 --- a/sphinx/themes/basic/static/searchtools.js +++ b/sphinx/themes/basic/static/searchtools.js @@ -296,6 +296,9 @@ var Search = { var tmp = query.split(/\s+/); var object = (tmp.length == 1) ? tmp[0].toLowerCase() : null; for (var i = 0; i < tmp.length; i++) { + // ignore leading/trailing whitespace + if (tmp[i] == "") + continue; // stem the word var word = stemmer.stemWord(tmp[i]).toLowerCase(); // select the correct list