code: def test_daterange_facet():
      schema = fields.Schema(id=fields.STORED, date=fields.DATETIME)
      ix = RamStorage().create_index(schema)
      w = ix.writer()
      w.add_document(id=0, date=datetime(2001, 1, 15))
      w.add_document(id=1, date=datetime(2001, 1, 10))
      w.add_document(id=2)
      w.add_document(id=3, date=datetime(2001, 1, 3))
      w.add_document(id=4, date=datetime(2001, 1, 8))
      w.add_document(id=5, date=datetime(2001, 1, 6))
      w.commit()
  
      with ix.searcher() as s:
          rf = sorting.DateRangeFacet(
              "date",
              datetime(2001, 1, 1),
              datetime(2001, 1, 20),
              timedelta(days=5),
          )
          r = s.search(query.Every(), groupedby={"date": rf})
          dt = datetime
          assert r.groups("date") == {
              (dt(2001, 1, 1, 0, 0), dt(2001, 1, 6, 0, 0)): [3],
              (dt(2001, 1, 6, 0, 0), dt(2001, 1, 11, 0, 0)): [1, 4, 5],
              (dt(2001, 1, 11, 0, 0), dt(2001, 1, 16, 0, 0)): [0],
              None: [2],
          }
  
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 21 for calling a global function with example usage: test_daterange_facet() without return types