Issue #112 new

possible Pickle problem between versions

Anonymous created an issue

I was testing creating index with 1.5.8 then open it in 1.7.3 (or 1.7.2) and I got a problem

{{{

!python

Traceback (most recent call last): File "./thawab-gtk", line 4, in <module> main() File "/opt/proj/thawab/Thawab/gtkUi.py", line 849, in main th, port, server=launchServer() File "/opt/proj/thawab/Thawab/gtkUi.py", line 831, in launchServer th=Thawab.core.ThawabMan(isMonolithic=False) File "/opt/proj/thawab/Thawab/core.py", line 71, in init self.searchEngine=SearchEngine(self) File "/opt/proj/thawab/Thawab/whooshSearchEngine.py", line 77, in init try: self.indexer=open_dir(ix_dir) File "/opt/proj/thawab/whoosh/index.py", line 101, in open_dir return storage.open_index(indexname) File "/opt/proj/thawab/whoosh/filedb/filestore.py", line 54, in open_index return FileIndex(self, schema=schema, indexname=indexname) File "/opt/proj/thawab/whoosh/filedb/fileindex.py", line 227, in init _read_toc(self.storage, self._schema, self.indexname) File "/opt/proj/thawab/whoosh/filedb/fileindex.py", line 148, in _read_toc schema = cPickle.loads(stream.read_string()) File "/opt/proj/thawab/whoosh/analysis.py", line 782, in setstate self.clear() File "/opt/proj/thawab/whoosh/analysis.py", line 785, in clear if self.cachesize < 0: AttributeError: 'StemFilter' object has no attribute 'cachesize' }}}

I guess pickled data are used to speed up loading and be removed, so place in such case make whoosh remove the old pickled data

Comments (10)

  1. Matt Chaput repo owner
    • changed status to open

    The StemFilter's attributes changed, so old instances can't be unpickled using the new class definition. I need to add a check for this to StemFilter's state methods.

  2. Anonymous

    yes, now it can opens the index, but when doing a query it will fail (traceback below from index on 1.5.8 and opened in 1.7.5)

    ----------------------------------------
    Exception happened during processing of request from ('127.0.0.1', 51254)
    Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/paste/httpserver.py", line 1068, in process_request_in_thread
        self.finish_request(request, client_address)
      File "/usr/lib64/python2.7/SocketServer.py", line 323, in finish_request
        self.RequestHandlerClass(request, client_address, self)
      File "/usr/lib64/python2.7/SocketServer.py", line 639, in __init__
        self.handle()
      File "/usr/lib/python2.7/site-packages/paste/httpserver.py", line 442, in handle
        BaseHTTPRequestHandler.handle(self)
      File "/usr/lib64/python2.7/BaseHTTPServer.py", line 337, in handle
        self.handle_one_request()
      File "/usr/lib/python2.7/site-packages/paste/httpserver.py", line 437, in handle_one_request
        self.wsgi_execute()
      File "/usr/lib/python2.7/site-packages/paste/httpserver.py", line 287, in wsgi_execute
        self.wsgi_start_response)
      File "/opt/proj/thawab/okasha/baseWebApp.py", line 465, in __call__
        try: r=f(rq, *a)
      File "/opt/proj/thawab/okasha/baseWebApp.py", line 244, in wrapper
        r=self._template(rq, func(*args), *self._templateArgs, **self._templateKw)
      File "/opt/proj/thawab/Thawab/webApp.py", line 279, in json
        R=self.th.searchEngine.queryIndex(q)
      File "/opt/proj/thawab/Thawab/whooshSearchEngine.py", line 118, in queryIndex
        try: r=self.__ix_searcher.search(self.__ix_qparser.parse(queryString), limit=500)
      File "/opt/proj/thawab/whoosh/qparser/default.py", line 223, in parse
        q = stream.query(self)
      File "/opt/proj/thawab/whoosh/qparser/syntax.py", line 147, in query
        return self.qclass([t.query(parser) for t in self.tokens],
      File "/opt/proj/thawab/whoosh/qparser/syntax.py", line 147, in query
        return self.qclass([t.query(parser) for t in self.tokens],
      File "/opt/proj/thawab/whoosh/qparser/syntax.py", line 480, in query
        removestops=self.removestops)
      File "/opt/proj/thawab/whoosh/qparser/default.py", line 168, in term_query
        removestops=removestops))
      File "/opt/proj/thawab/whoosh/fields.py", line 155, in <genexpr>
        return (t.text for t
      File "/opt/proj/thawab/whoosh/analysis.py", line 810, in __call__
        ignore = self.ignore
    AttributeError: 'StemFilter' object has no attribute 'ignore'
    
  3. Anonymous

    here traceback between 1.5.9 and 1.7.5

    Exception happened during processing of request from ('127.0.0.1', 59376)
    Traceback (most recent call last):
      File "/usr/lib/pymodules/python2.6/paste/httpserver.py", line 1068, in process_request_in_thread
        self.finish_request(request, client_address)
      File "/usr/lib/python2.6/SocketServer.py", line 322, in finish_request
        self.RequestHandlerClass(request, client_address, self)
      File "/usr/lib/python2.6/SocketServer.py", line 617, in __init__
        self.handle()
      File "/usr/lib/pymodules/python2.6/paste/httpserver.py", line 442, in handle
        BaseHTTPRequestHandler.handle(self)
      File "/usr/lib/python2.6/BaseHTTPServer.py", line 329, in handle
        self.handle_one_request()
      File "/usr/lib/pymodules/python2.6/paste/httpserver.py", line 437, in handle_one_request
        self.wsgi_execute()
      File "/usr/lib/pymodules/python2.6/paste/httpserver.py", line 287, in wsgi_execute
        self.wsgi_start_response)
      File "/usr/lib/python2.6/dist-packages/okasha/baseWebApp.py", line 461, in __call__
        try: r=f(rq, *a)
      File "/usr/lib/python2.6/dist-packages/okasha/baseWebApp.py", line 244, in wrapper
        r=self._template(rq, func(*args), *self._templateArgs, **self._templateKw)
      File "/usr/share/thawab/Thawab/webApp.py", line 274, in json
        R=self.th.searchEngine.queryIndex(q)
      File "/usr/share/thawab/Thawab/whooshSearchEngine.py", line 119, in queryIndex
        except QueryParserError: return None
    NameError: global name 'QueryParserError' is not defined
    
  4. Log in to comment