View difference between Paste ID: m2dNrEA6 and pcAep5iG
SHOW: | | - or go back to the newest paste.
1
def query(self, query_str):
2
    qp = QueryParser("content", ix.schema)
3
    q = qp.parse(unicode(query_str))
4
    with self.ix.searcher() as searcher:
5
        results = searcher.search(q)
6
	return results
7
"""
8
and using results later in some other code raises this error,
9
  File "main.py", line 62, in <module>
10
    main()
11
  File "main.py", line 57, in main
12
    print result
13
  File "/usr/lib/python2.7/dist-packages/whoosh/searching.py", line 1469, in __repr__
14
    return "<%s %r>" % (self.__class__.__name__, self.fields())
15
  File "/usr/lib/python2.7/dist-packages/whoosh/searching.py", line 1377, in fields
16
    self._fields = self.searcher.stored_fields(self.docnum)
17
  File "/usr/lib/python2.7/dist-packages/whoosh/filedb/filereading.py", line 136, in stored_fields
18
    return dict(item for item in iteritems(self._stored[docnum])
19
  File "/usr/lib/python2.7/dist-packages/whoosh/codec/whoosh2.py", line 899, in __getitem__
20-
ValueError: I/O operation on closed file
20+
21
ValueError: I/O operation on closed file
22
"""