code: def test_add_sortable():
      st = RamStorage()
      schema = fields.Schema(
          chapter=fields.ID(stored=True), price=fields.NUMERIC
      )
      ix = st.create_index(schema)
      with ix.writer() as w:
          w.add_document(chapter=u("alfa"), price=100)
          w.add_document(chapter=u("bravo"), price=200)
          w.add_document(chapter=u("charlie"), price=300)
          w.add_document(chapter=u("delta"), price=400)
      with ix.writer() as w:
          w.add_document(chapter=u("bravo"), price=500)
          w.add_document(chapter=u("alfa"), price=600)
          w.add_document(chapter=u("delta"), price=100)
          w.add_document(chapter=u("charlie"), price=200)
          w.merge = False
  
      with ix.reader() as r:
          assert not r.has_column("chapter")
          assert not r.has_column("price")
  
      with ix.writer() as w:
          sorting.add_sortable(
              w, "chapter", sorting.StoredFieldFacet("chapter")
          )
          sorting.add_sortable(w, "price", sorting.FieldFacet("price"))
          w.merge = False
  
      with ix.reader() as r:
          assert r.has_column("chapter")
          assert r.has_column("price")
  
          chapr = r.column_reader("chapter")
          pricer = r.column_reader("price")
  
          assert chapr[0] == "alfa"
          assert pricer[0] == 100
  
      ix.optimize()
  
      with ix.reader() as r:
          assert r.has_column("chapter")
          assert r.has_column("price")
  
          chapr = r.column_reader("chapter")
          pricer = r.column_reader("price")
  
          assert chapr[0] == "alfa"
          assert pricer[0] == 100
  
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 35 for calling a global function with example usage: test_add_sortable() without return types