code: def test_workflow_manual():
      schema = fields.Schema(
          id=fields.ID(stored=True), title=fields.TEXT(stored=True)
      )
      ix = RamStorage().create_index(schema)
  
      w = ix.writer()
      w.add_document(id=u("1"), title=u("The man who wasn't there"))
      w.add_document(
          id=u("2"), title=u("The dog who barked at midnight")
      )
      w.add_document(id=u("3"), title=u("The invisible man"))
      w.add_document(
          id=u("4"), title=u("The girl with the dragon tattoo")
      )
      w.add_document(id=u("5"), title=u("The woman who disappeared"))
      w.commit()
  
      with ix.searcher() as s:
          # Parse the user query
          parser = qparser.QueryParser("title", schema=ix.schema)
          q = parser.parse(u("man"))
  
          # Extract the terms the user used in the field we're interested in
          terms = [
              text
              for fieldname, text in q.all_terms()
              if fieldname == "title"
          ]
  
          # Perform the search
          r = s.search(q)
          assert len(r) == 2
  
          # Use the same analyzer as the field uses. To be sure, you can
          # do schema[fieldname].analyzer. Be careful not to do this
          # on non-text field types such as DATETIME.
          analyzer = schema["title"].analyzer
  
          # Since we want to highlight the full title, not extract fragments,
          # we'll use WholeFragmenter.
          nf = highlight.WholeFragmenter()
  
          # In this example we'll simply uppercase the matched terms
          fmt = highlight.UppercaseFormatter()
  
          outputs = []
          for d in r:
              text = d["title"]
              outputs.append(
                  highlight.highlight(text, terms, analyzer, nf, fmt)
              )
  
          assert outputs == [
              "The invisible MAN",
              "The MAN who wasn't there",
          ]
  
imports: from __future__ import with_statement
  import pytest
  from whoosh import analysis, highlight, fields, qparser, query
  from whoosh.compat import u
  from whoosh.filedb.filestore import RamStorage
  from whoosh.util.testing import TempIndex
label_desc: Use image node_id 10 for calling a global function with example usage: test_workflow_manual() without return types