code: def test_buffered_search():
      schema = fields.Schema(id=fields.STORED, text=fields.TEXT)
      with TempIndex(schema, "bufferedsearch") as ix:
          w = writing.BufferedWriter(ix, period=None, limit=5)
          w.add_document(id=1, text="alfa bravo charlie")
          w.add_document(id=2, text="bravo tango delta")
          w.add_document(id=3, text="tango delta echo")
          w.add_document(id=4, text="charlie delta echo")
  
          with w.searcher() as s:
              r = s.search(query.Term("text", "tango"))
              assert sorted([d["id"] for d in r]) == [2, 3]
  
          w.add_document(id=5, text="foxtrot golf hotel")
          w.add_document(id=6, text="india tango juliet")
          w.add_document(id=7, text="tango kilo lima")
          w.add_document(id=8, text="mike november echo")
  
          with w.searcher() as s:
              r = s.search(query.Term("text", "tango"))
              assert sorted([d["id"] for d in r]) == [2, 3, 6, 7]
  
          w.close()
  
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 6 for calling a global function with example usage: test_buffered_search() without return types