code: def test_groupby_phrase():
      domain = {
          "Alan Ball": "Tel Aviv",
          "Alan Charles": "San Francisco",
          "Alan Darwin": "London",
          "Alan Eames": "Paris",
      }
  
      schema = fields.Schema(
          name=fields.TEXT(stored=True),
          city=fields.TEXT(stored=True),
          city_g=fields.ID(stored=True),
      )
      ix = RamStorage().create_index(schema)
      with ix.writer() as w:
          for name, city in domain.items():
              w.add_document(name=u(name), city=u(city), city_g=u(city))
  
      with ix.searcher() as s:
          q = query.Term("name", "alan")
          r = s.search(q, groupedby="city_g")
          keys = sorted(r.groups().keys())
          assert keys == [
              "London",
              "Paris",
              "San Francisco",
              "Tel Aviv",
          ]
  
          sff = sorting.StoredFieldFacet("city")
          r = s.search(q, groupedby=sff)
          keys = sorted(r.groups().keys())
          assert keys == [
              "London",
              "Paris",
              "San Francisco",
              "Tel Aviv",
          ]
  
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 32 for calling a global function with example usage: test_groupby_phrase() without return types