diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2016-05-26 00:57:58 +0900 |
|---|---|---|
| committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2016-05-26 00:57:58 +0900 |
| commit | 581a26168d711f709fe223c1249bee4fc98ed187 (patch) | |
| tree | c10c6f4ab79a186f815fe371925acdfdea7a904d | |
| parent | 5087228977caf5f750cb4d3af2097e68aa1c4bb5 (diff) | |
| parent | 94f2dc2843db9efbdbcfcef44f49cbd1bd7098cd (diff) | |
| download | sphinx-git-581a26168d711f709fe223c1249bee4fc98ed187.tar.gz | |
Merge pull request #2556 from mitya57/xapian-python3
Make Xapian search work with Python 3
| -rw-r--r-- | sphinx/websupport/search/xapiansearch.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sphinx/websupport/search/xapiansearch.py b/sphinx/websupport/search/xapiansearch.py index ee9b33da7..1e43dcbe9 100644 --- a/sphinx/websupport/search/xapiansearch.py +++ b/sphinx/websupport/search/xapiansearch.py @@ -11,6 +11,8 @@ import xapian +from six import string_types + from sphinx.util.osutil import ensuredir from sphinx.websupport.search import BaseSearch @@ -73,7 +75,10 @@ class XapianSearch(BaseSearch): results = [] for m in matches: - context = self.extract_context(m.document.get_data()) + data = m.document.get_data() + if not isinstance(data, string_types): + data = data.decode("utf-8") + context = self.extract_context(data) results.append((m.document.get_value(self.DOC_PATH), m.document.get_value(self.DOC_TITLE), ''.join(context))) |
