Skip to content

Commit

Permalink
Make Xapian search work with Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
mitya57 committed May 25, 2016
1 parent 03af1ca commit 94f2dc2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sphinx/websupport/search/xapiansearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import xapian

from six import string_types

from sphinx.util.osutil import ensuredir
from sphinx.websupport.search import BaseSearch

Expand Down Expand Up @@ -73,7 +75,10 @@ def handle_query(self, q):
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)))
Expand Down

0 comments on commit 94f2dc2

Please sign in to comment.