code: def test_optimize_away():
      schema = fields.Schema(
          id=fields.ID(stored=True),
          content=fields.TEXT,
          city=fields.KEYWORD(stored=True),
      )
      with TempIndex(schema, "optimizeaway") as ix:
          w = ix.writer()
          w.add_document(
              id=u("b"), content=u("bravo"), city=u("baghdad")
          )
          w.add_document(
              id=u("c"), content=u("charlie"), city=u("cairo")
          )
          w.add_document(id=u("d"), content=u("delta"), city=u("dakar"))
          w.commit()
  
          with ix.searcher() as s:
              assert s.document(id=u("c")) == {
                  "id": "c",
                  "city": "cairo",
              }
  
          w = ix.writer()
          w.remove_field("content")
          w.remove_field("city")
          w.commit(optimize=True)
  
          with ix.searcher() as s:
              assert ("content", u("charlie")) not in s.reader()
              assert s.document(id=u("c")) == {"id": u("c")}
  
file_path: whoosh/tests/test_flexible.py
imports: from __future__ import with_statement
  from whoosh import fields
  from whoosh.compat import u, b
  from whoosh.util.testing import TempIndex
label_desc: Use image node_id 4 for calling a global function with example usage: test_optimize_away() without return types