code: def test_deleteall():
      schema = fields.Schema(text=fields.TEXT)
      with TempIndex(schema, "deleteall") as ix:
          w = ix.writer()
          domain = u("alfa bravo charlie delta echo").split()
          for i, ls in enumerate(permutations(domain)):
              w.add_document(text=u(" ").join(ls))
              if not i % 10:
                  w.commit()
                  w = ix.writer()
          w.commit()
  
          # This is just a test, don't use this method to delete all docs IRL!
          doccount = ix.doc_count_all()
          w = ix.writer()
          for docnum in xrange(doccount):
              w.delete_document(docnum)
          w.commit()
  
          with ix.searcher() as s:
              r = s.search(
                  query.Or(
                      [
                          query.Term("text", u("alfa")),
                          query.Term("text", u("bravo")),
                      ]
                  )
              )
              assert len(r) == 0
  
          ix.optimize()
          assert ix.doc_count_all() == 0
  
          with ix.reader() as r:
              assert list(r) == []
  
imports: from __future__ import with_statement
  import random
  from collections import defaultdict
  from datetime import datetime
  import pytest
  from whoosh import analysis, fields, index, qparser, query, __version__
  from whoosh.compat import b, u, xrange, text_type, permutations
  from whoosh.filedb.filestore import RamStorage
  from whoosh.writing import IndexingError
  from whoosh.util.numeric import length_to_byte, byte_to_length
  from whoosh.util.testing import TempIndex, TempStorage
label_desc: Use image node_id 21 for calling a global function with example usage: test_deleteall() without return types