Issue #341 new

single-segment buffer object expected

goffer_looney
created an issue

I get the above error message when I try to highlight a field.

hit.highlights('description')

Where hit looks like this:

<Hit {'type': u'manuscripts', 'description': u"(A version of Wulfstan's 'Handbook') : Amalarius (?), Eclogae de ordine Romano ; Excerpts from Isidore and Jerome; De ecclesiasticis gradibus ; Wulfstan (?), Two sermons ; Abbo of Saint-Germain, Sermones 6--13 ; Letters relating to penitence by Wulfstan and by Pope John XVIII ; Fifteen sermons (including Wulfstan Ia and VIIIa) ; Excerpts from Scripture by Wulfstan ; \xc6lfric, Pastoral Letters 2 and 3 ; De officio missae : c. 1002--1023, Worcester (and York?), prov. Denmark (Roskilde) s. xi? FC: The Copenhagen Wulfstan Collection, ed. J. E. Crass and J. Morrish Tunberg, EEMF 25 (Copenhagen, 1993).\r\n\r\nKer: Note on f. 66v of s. xi1, in hand of Wulfstan?\r\n\r\nKer 1948, p. 54-5: Assoc'd with Wulfstan. Has annotations by Wulfstan.", 'id': u'1534'}>

Here's the call stack:

File "c:\Users\Geoff\workspace\digipal\dp\digipal-django\digipal\views\content_type\search_manuscripts.py" in get_records_from_ids
  86.                 record.description_snippet = hit.highlights('description')
File "c:\Users\Geoff\workspace\digipal\dp\dp\lib\site-packages\whoosh\searching.py" in highlights
  1443.         return hliter.highlight_hit(self, fieldname, text=text, top=top)
File "c:\Users\Geoff\workspace\digipal\dp\dp\lib\site-packages\whoosh\highlight.py" in highlight_hit
  857.             bterms = results.query_terms(expand=True, fieldname=fieldname)
File "c:\Users\Geoff\workspace\digipal\dp\dp\lib\site-packages\whoosh\searching.py" in query_terms
  1171.                                      fieldname=fieldname, expand=expand)
File "c:\Users\Geoff\workspace\digipal\dp\dp\lib\site-packages\whoosh\query\qcore.py" in existing_terms
  361.                     if (fieldname, btext) in ixreader:
File "c:\Users\Geoff\workspace\digipal\dp\dp\lib\site-packages\whoosh\reading.py" in __contains__
  649.         return (fieldname, text) in self._terms
File "c:\Users\Geoff\workspace\digipal\dp\dp\lib\site-packages\whoosh\codec\whoosh3.py" in __contains__
  520.         return self._keycoder(*term) in self._tindex
File "c:\Users\Geoff\workspace\digipal\dp\dp\lib\site-packages\whoosh\filedb\filetables.py" in __contains__
  338.         for _ in self.ranges_for_key(key):
File "c:\Users\Geoff\workspace\digipal\dp\dp\lib\site-packages\whoosh\filedb\filetables.py" in ranges_for_key
  397.             slothash, itempos = unpackptr(dbfile.get(slotpos, ptrsize))
File "c:\Users\Geoff\workspace\digipal\dp\dp\lib\site-packages\whoosh\filedb\structfile.py" in get
  368.         return bytes_type(self._buf[position:position + length])

Exception Type: TypeError at /digipal/search/
Exception Value: single-segment buffer object expected

Whoosh 2.5.0, Pyhon 2.7.2.5

Comments (2)

  1. Matt Chaput repo owner

    Please try the following:

    1. Get the latest version from the bitbucket repo and see if the problem is fixed.
    2. If it's not fixed, trying adding a "print self._buf" statement in whoosh/filedb/structfile.py above the last line in the traceback (line 368) and let me know what it says.

    Thanks!

  2. Log in to comment