code: def test_compatibility():
      from whoosh.scoring import Weighting
  
      # This is the old way of doing a custom weighting model, check that
      # it's still supported...
      class LegacyWeighting(Weighting):
          use_final = True
  
          def score(self, searcher, fieldname, text, docnum, weight):
              return weight + 0.5
  
          def final(self, searcher, docnum, score):
              return score * 1.5
  
      schema = fields.Schema(text=fields.TEXT)
      ix = RamStorage().create_index(schema)
      w = ix.writer()
      domain = "alfa bravo charlie delta".split()
      for ls in permutations(domain, 3):
          w.add_document(text=u(" ").join(ls))
      w.commit()
  
      s = ix.searcher(weighting=LegacyWeighting())
      r = s.search(query.Term("text", u("bravo")))
      assert r.score(0) == 2.25
  
file_path: whoosh/tests/test_weightings.py
imports: from __future__ import with_statement
  import inspect
  from random import choice, randint
  import sys
  from whoosh import fields, query, scoring
  from whoosh.compat import u, xrange, permutations
  from whoosh.filedb.filestore import RamStorage
label_desc: Use image node_id 3 for calling a global function with example usage: test_compatibility() and returns: unknown, unknown