code: def test_doc_boost():
      schema = fields.Schema(
          id=fields.STORED, a=fields.TEXT, b=fields.TEXT
      )
      ix = RamStorage().create_index(schema)
      w = ix.writer()
      w.add_document(id=0, a=u("alfa alfa alfa"), b=u("bravo"))
      w.add_document(id=1, a=u("alfa"), b=u("bear"), _a_boost=5.0)
      w.add_document(id=2, a=u("alfa alfa alfa alfa"), _boost=0.5)
      w.commit()
  
      with ix.searcher() as s:
          r = s.search(query.Term("a", "alfa"))
          assert [hit["id"] for hit in r] == [1, 0, 2]
  
      w = ix.writer()
      w.add_document(id=3, a=u("alfa"), b=u("bottle"))
      w.add_document(id=4, b=u("bravo"), _b_boost=2.0)
      w.commit(merge=False)
  
      with ix.searcher() as s:
          r = s.search(query.Term("a", "alfa"))
          assert [hit["id"] for hit in r] == [1, 0, 3, 2]
  
imports: from __future__ import with_statement
  import random
  from collections import defaultdict
  from datetime import datetime
  import pytest
  from whoosh import analysis, fields, index, qparser, query, __version__
  from whoosh.compat import b, u, xrange, text_type, permutations
  from whoosh.filedb.filestore import RamStorage
  from whoosh.writing import IndexingError
  from whoosh.util.numeric import length_to_byte, byte_to_length
  from whoosh.util.testing import TempIndex, TempStorage
label_desc: Use image node_id 27 for calling a global function with example usage: test_doc_boost() without return types