From 9226513c8b9f8fea5991fd9408181664dcb2473d Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 26 May 2016 20:59:29 +0900 Subject: [PATCH] Fix #2581: The search doesn't work if language="es" (spanish) --- CHANGES | 1 + sphinx/search/__init__.py | 2 +- sphinx/search/de.py | 1 - sphinx/search/en.py | 1 - sphinx/search/ja.py | 2 +- sphinx/search/zh.py | 1 - 6 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 676bb2fda7..d4a5492591 100644 --- a/CHANGES +++ b/CHANGES @@ -68,6 +68,7 @@ Bugs fixed * #2576: ``sphinx.ext.imgmath`` crashes if subprocess raises error * #2577: ``sphinx.ext.imgmath``: Invalid argument are passed to dvisvgm * #2556: Xapian search does not work with Python 3 +* #2581: The search doesn't work if language="es" (spanish) Release 1.4.1 (released Apr 12, 2016) diff --git a/sphinx/search/__init__.py b/sphinx/search/__init__.py index 13fb4d528e..1fedc5352e 100644 --- a/sphinx/search/__init__.py +++ b/sphinx/search/__init__.py @@ -362,7 +362,7 @@ class IndexBuilder(object): try: return self._stem_cache[word] except KeyError: - self._stem_cache[word] = self.lang.stem(word) + self._stem_cache[word] = self.lang.stem(word).lower() return self._stem_cache[word] _filter = self.lang.word_filter diff --git a/sphinx/search/de.py b/sphinx/search/de.py index 35c6263c4d..89cbe3de51 100644 --- a/sphinx/search/de.py +++ b/sphinx/search/de.py @@ -311,5 +311,4 @@ class SearchGerman(SearchLanguage): self.stemmer = snowballstemmer.stemmer('german') def stem(self, word): - word = word.lower() return self.stemmer.stemWord(word) diff --git a/sphinx/search/en.py b/sphinx/search/en.py index 9501cddebc..39c3287603 100644 --- a/sphinx/search/en.py +++ b/sphinx/search/en.py @@ -237,7 +237,6 @@ class SearchEnglish(SearchLanguage): make at least the stem method nicer. """ def stem(self, word): - word = word.lower() return PorterStemmer.stem(self, word, 0, len(word) - 1) self.stemmer = Stemmer() diff --git a/sphinx/search/ja.py b/sphinx/search/ja.py index 9e02926f0c..0d4d01b9cc 100644 --- a/sphinx/search/ja.py +++ b/sphinx/search/ja.py @@ -556,4 +556,4 @@ class SearchJapanese(SearchLanguage): return len(stemmed_word) > 1 def stem(self, word): - return word.lower() + return word diff --git a/sphinx/search/zh.py b/sphinx/search/zh.py index 92f66e971a..c1fecefc63 100644 --- a/sphinx/search/zh.py +++ b/sphinx/search/zh.py @@ -256,7 +256,6 @@ class SearchChinese(SearchLanguage): make at least the stem method nicer. """ def stem(self, word): - word = word.lower() return PorterStemmer.stem(self, word, 0, len(word) - 1) self.stemmer = Stemmer()