code: def test_span_term():
      ix = get_index()
      with ix.searcher() as s:
          alllists = [d["text"] for d in s.all_stored_fields()]
  
          for word in domain:
              q = Term("text", word)
              m = q.matcher(s)
  
              ids = set()
              while m.is_active():
                  id = m.id()
                  sps = m.spans()
                  ids.add(id)
                  original = list(s.stored_fields(id)["text"])
                  assert word in original
  
                  if word != "bravo":
                      assert len(sps) == 1
                  assert original.index(word) == sps[0].start
                  assert original.index(word) == sps[0].end
                  m.next()
  
              for i, ls in enumerate(alllists):
                  if word in ls:
                      assert i in ids
                  else:
                      assert i not in ids
  
imports: from __future__ import with_statement
  from whoosh import analysis, fields, formats
  from whoosh.compat import u, xrange, permutations
  from whoosh.filedb.filestore import RamStorage
  from whoosh.query import spans
  from whoosh.query import And, Or, Term, Phrase
  from whoosh.util.testing import TempIndex
label_desc: Use image node_id 4 for calling a global function with example usage: test_span_term() without return types