diff options
-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))) |