AsyncWriter missing method

Issue #68 resolved
Lele Gaifax
created an issue

The AsyncWriter class seems missing a //redirect// for the method delete_by_term(). The code snippet that triggers the problem for me is: {{{


from whoosh.writing import AsyncWriter

writer = AsyncWriter(self.catalog) with writer: for guid, kind, public, content in self.queue: writer.delete_by_term('guid', guid) writer.add_document(guid=guid, kind=kind, public=public, content=content) }}}

which raises an error about a not defined method (self.is_deleted()). Effectively, since AsyncWriter descends from IndexWriter, in version 1.3.3 it executes the inherited .delete_by_term(), which in turn calls .delete_by_query() that uses the .is_deleted() method.

I was able to //fix// the issue with the following patch: {{{ diff -r a28cded35186 src/whoosh/ --- a/src/whoosh/ Mon Nov 08 11:48:40 2010 -0500 +++ b/src/whoosh/ Tue Nov 09 16:45:18 2010 +0100 @@ -291,7 +291,10 @@

 def remove_field(self, *args, **kwargs):
     self._record("remove_field", args, kwargs)
  • def delete_by_term(self, args, *kwargs):
  • self._record("delete_by_term", args, kwargs) + def commit(self, *args, kwargs): if self.writer: self.writer.commit(*args, kwargs) }}}

Maybe it should redirect also the method delete_by_query() (in general, all //public// methods inherited from IndexWriter)?

Hope this helps, and thank you for the module!

Comments (1)

  1. Log in to comment