diff options
| author | Takayuki Shimizukawa <shimizukawa@gmail.com> | 2013-01-04 21:46:17 +0900 |
|---|---|---|
| committer | Takayuki Shimizukawa <shimizukawa@gmail.com> | 2013-01-04 21:46:17 +0900 |
| commit | 19a8c9e2e5715b1099898378f7d6bb880f0753fa (patch) | |
| tree | 1efb0c796f8038d5043bd95ae66c901fb63a121c | |
| parent | 73b8622f0931f0a915f5322956bb3a7e4ba4a5c2 (diff) | |
| download | sphinx-git-19a8c9e2e5715b1099898378f7d6bb880f0753fa.tar.gz | |
fix problems with py25,py3x for search index generation
| -rw-r--r-- | sphinx/search/__init__.py | 7 | ||||
| -rw-r--r-- | tests/test_search.py | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/sphinx/search/__init__.py b/sphinx/search/__init__.py index e43e5d917..3a43ae8e1 100644 --- a/sphinx/search/__init__.py +++ b/sphinx/search/__init__.py @@ -8,6 +8,7 @@ :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ +from __future__ import with_statement import re import itertools import cPickle as pickle @@ -294,17 +295,17 @@ class IndexBuilder(object): doctree.walk(visitor) stem = self.lang.stem - filter = self.lang.word_filter + _filter = self.lang.word_filter for word in itertools.chain(visitor.found_title_words, self.lang.split(title)): word = stem(word) - if filter(word): + if _filter(word): self._title_mapping.setdefault(word, set()).add(filename) for word in visitor.found_words: word = stem(word) - if word not in self._title_mapping and filter(word): + if word not in self._title_mapping and _filter(word): self._mapping.setdefault(word, set()).add(filename) def context_for_searchtool(self): diff --git a/tests/test_search.py b/tests/test_search.py index f2c174065..e5ae71e96 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -36,7 +36,7 @@ def test_wordcollector(): doc['file'] = 'dummy' parser.parse(FILE_CONTENTS, doc) - ix = IndexBuilder(None, 'en', {}) + ix = IndexBuilder(None, 'en', {}, None) ix.feed('filename', 'title', doc) assert 'boson' not in ix._mapping assert 'fermion' in ix._mapping |
