code: def test_correct_query():
      schema = fields.Schema(a=fields.TEXT(), b=fields.TEXT)
      with TempIndex(schema) as ix:
          with ix.writer() as w:
              w.add_document(a="alfa bravo charlie delta")
              w.add_document(a="delta echo foxtrot golf")
              w.add_document(a="golf hotel india juliet")
              w.add_document(a="juliet kilo lima mike")
  
          with ix.searcher() as s:
              qp = QueryParser("a", ix.schema)
              qtext = 'alpha ("brovo november" OR b:dolta) detail'
              q = qp.parse(qtext, ix.schema)
  
              c = s.correct_query(q, qtext)
              cq = c.query
              assert isinstance(cq, query.And)
              assert cq[0].text == "alfa"
              assert isinstance(cq[1], query.Or)
              assert isinstance(cq[1][0], query.Phrase)
              assert cq[1][0].words == ["bravo", "november"]
  
              qtext = 'alpha b:("brovo november" a:delta) detail'
              q = qp.parse(qtext, ix.schema)
              c = s.correct_query(q, qtext)
              assert (
                  c.query.__unicode__()
                  == '(a:alfa AND b:"brovo november" AND a:delta AND a:detail)'
              )
              assert (
                  c.string == 'alfa b:("brovo november" a:delta) detail'
              )
  
              hf = highlight.HtmlFormatter(classname="c")
              assert (
                  c.format_string(hf)
                  == '<strong class="c term0">alfa</strong> b:("brovo november" a:delta) detail'
              )
  
imports: from __future__ import with_statement
  import gzip
  from whoosh import analysis, fields, highlight, query, spelling
  from whoosh.compat import u
  from whoosh.qparser import QueryParser
  from whoosh.support.levenshtein import levenshtein
  from whoosh.util.testing import TempIndex
label_desc: Use image node_id 8 for calling a global function with example usage: test_correct_query() without return types