code: def test_add_reader():
      schema = fields.Schema(
          i=fields.ID(stored=True, unique=True),
          a=fields.TEXT(stored=True, spelling=True),
          b=fields.TEXT(vector=True),
      )
      with TempIndex(schema, "addreader") as ix:
          with ix.writer() as w:
              w.add_document(
                  i="0",
                  a="alfa bravo charlie delta",
                  b="able baker coxwell dog",
              )
              w.add_document(
                  i="1",
                  a="bravo charlie delta echo",
                  b="elf fabio gong hiker",
              )
              w.add_document(
                  i="2",
                  a="charlie delta echo foxtrot",
                  b="india joker king loopy",
              )
              w.add_document(
                  i="3",
                  a="delta echo foxtrot golf",
                  b="mister noogie oompah pancake",
              )
  
          with ix.writer() as w:
              w.delete_by_term("i", "1")
              w.delete_by_term("i", "3")
  
          with ix.writer() as w:
              w.add_document(
                  i="4",
                  a="hotel india juliet kilo",
                  b="quick rhubarb soggy trap",
              )
              w.add_document(
                  i="5",
                  a="india juliet kilo lima",
                  b="umber violet weird xray",
              )
              w.optimize = True
  
          with ix.reader() as r:
              assert r.doc_count() == 4
  
              sfs = sorted(r.all_stored_fields(), key=lambda d: d["i"])
              assert sfs == [
                  {"i": "0", "a": "alfa bravo charlie delta"},
                  {"i": "2", "a": "charlie delta echo foxtrot"},
                  {"i": "4", "a": "hotel india juliet kilo"},
                  {"i": "5", "a": "india juliet kilo lima"},
              ]
  
              assert (
                  " ".join(r.field_terms("a"))
                  == "alfa bravo charlie delta echo foxtrot hotel india juliet kilo lima"
              )
  
              vs = []
              for docnum in r.all_doc_ids():
                  v = r.vector(docnum, "b")
                  vs.append(list(v.all_ids()))
              assert vs == [
                  ["quick", "rhubarb", "soggy", "trap"],
                  ["umber", "violet", "weird", "xray"],
                  ["able", "baker", "coxwell", "dog"],
                  ["india", "joker", "king", "loopy"],
              ]
  
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 13 for calling a global function with example usage: test_add_reader() without return types