code: def test_clear():
      schema = fields.Schema(a=fields.KEYWORD)
      ix = RamStorage().create_index(schema)
  
      # Add some segments
      with ix.writer() as w:
          w.add_document(a="one two three")
          w.merge = False
      with ix.writer() as w:
          w.add_document(a="two three four")
          w.merge = False
      with ix.writer() as w:
          w.add_document(a="three four five")
          w.merge = False
  
      # Clear
      with ix.writer() as w:
          w.add_document(a="foo bar baz")
          w.mergetype = writing.CLEAR
  
      with ix.searcher() as s:
          assert s.doc_count_all() == 1
          assert list(s.reader().lexicon("a")) == [
              b("bar"),
              b("baz"),
              b("foo"),
          ]
  
imports: from __future__ import with_statement
  import random, time, threading
  import pytest
  from whoosh import analysis, fields, query, writing
  from whoosh.compat import b, u, xrange, text_type
  from whoosh.filedb.filestore import RamStorage
  from whoosh.util.testing import TempIndex
label_desc: Use image node_id 15 for calling a global function with example usage: test_clear() without return types