code: def test_termdocs():
      schema = fields.Schema(key=fields.TEXT, city=fields.ID)
      ix = RamStorage().create_index(schema)
      with ix.writer() as w:
          w.add_document(key="ant", city="london")
          w.add_document(key="anteater", city="roma")
          w.add_document(key="bear", city="london")
          w.add_document(key="bees", city="roma")
          w.add_document(key="anorak", city="london")
          w.add_document(key="antimatter", city="roma")
          w.add_document(key="angora", city="london")
          w.add_document(key="angels", city="roma")
  
      with ix.searcher() as s:
          cond_q = query.Term("city", "london")
          pref_q = query.Prefix("key", "an")
          q = query.And([cond_q, pref_q]).normalize()
          r = s.search(q, scored=False, terms=True)
  
          field = s.schema["key"]
          terms = [
              field.from_bytes(term)
              for fieldname, term in r.termdocs
              if fieldname == "key"
          ]
          assert sorted(terms) == ["angora", "anorak", "ant"]
  
file_path: whoosh/tests/test_collector.py
imports: from __future__ import with_statement
  import pytest
  from whoosh import collectors, fields, query, searching
  from whoosh.compat import u, xrange
  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_termdocs() without return types