(self, q, searcher=None)
return count
Deletes any documents matching a query object.

        :returns: the number of documents deleted.
Deletes any documents matching a query object.
Deletes any documents matching a query object .
def delete_by_query(self, q, searcher=None):
        """Deletes any documents matching a query object.

        :returns: the number of documents deleted.
        """

        if searcher:
            s = searcher
        else:
            s = self.searcher()

        try:
            count = 0
            for docnum in s.docs_for_query(q, for_deletion=True):
                self.delete_document(docnum)
                count += 1
        finally:
            if not searcher:
                s.close()

        return count
def delete_by_query ( self , q , searcher = None ) : if searcher : s = searcher else : s = self . searcher ( ) try : count = 0 for docnum in s . docs_for_query ( q , for_deletion = True ) : self . delete_document ( docnum ) count += 1 finally : if not searcher : s . close ( ) return count