code: def test_nocachefield_segments():
      schema = fields.Schema(a=fields.ID(stored=True))
      ix = RamStorage().create_index(schema)
      w = ix.writer()
      w.add_document(a=u("bravo"))
      w.add_document(a=u("echo"))
      w.add_document(a=u("juliet"))
      w.commit()
      w = ix.writer()
      w.add_document(a=u("kilo"))
      w.add_document(a=u("foxtrot"))
      w.add_document(a=u("charlie"))
      w.commit(merge=False)
      w = ix.writer()
      w.delete_by_term("a", u("echo"))
      w.add_document(a=u("alfa"))
      w.add_document(a=u("india"))
      w.add_document(a=u("delta"))
      w.commit(merge=False)
  
      with ix.searcher() as s:
          q = query.TermRange("a", u("bravo"), u("k"))
          facet = sorting.FieldFacet("a", reverse=True)
  
          r = s.search(q, sortedby=facet)
          assert [hit["a"] for hit in r] == [
              "juliet",
              "india",
              "foxtrot",
              "delta",
              "charlie",
              "bravo",
          ]
  
          mq = query.Or(
              [query.Term("a", u("bravo")), query.Term("a", u("delta"))]
          )
          anq = query.AndNot(q, mq)
          r = s.search(anq, sortedby=facet)
          assert [hit["a"] for hit in r] == [
              "juliet",
              "india",
              "foxtrot",
              "charlie",
          ]
  
          mq = query.Or(
              [query.Term("a", u("bravo")), query.Term("a", u("delta"))]
          )
          r = s.search(q, mask=mq, sortedby=facet)
          assert [hit["a"] for hit in r] == [
              "juliet",
              "india",
              "foxtrot",
              "charlie",
          ]
  
          fq = query.Or(
              [
                  query.Term("a", u("alfa")),
                  query.Term("a", u("charlie")),
                  query.Term("a", u("echo")),
                  query.Term("a", u("india")),
              ]
          )
          r = s.search(query.Every(), filter=fq, sortedby=facet)
          assert [hit["a"] for hit in r] == ["india", "charlie", "alfa"]
  
          nq = query.Not(
              query.Or(
                  [
                      query.Term("a", u("alfa")),
                      query.Term("a", u("india")),
                  ]
              )
          )
          r = s.search(query.Every(), filter=nq, sortedby=facet)
          assert [hit["a"] for hit in r] == [
              "kilo",
              "juliet",
              "foxtrot",
              "delta",
              "charlie",
              "bravo",
          ]
  
imports: from __future__ import with_statement
  from datetime import datetime, timedelta
  import random
  from whoosh import fields, query, sorting, columns
  from whoosh.compat import u
  from whoosh.compat import permutations, xrange
  from whoosh.filedb.filestore import RamStorage
  from whoosh.util.testing import TempIndex
label_desc: Use image node_id 31 for calling a global function with example usage: test_nocachefield_segments() without return types