code: def test_merged_lengths():
      s = fields.Schema(
          f1=fields.KEYWORD(stored=True, scorable=True),
          f2=fields.KEYWORD(stored=True, scorable=True),
      )
      with TempIndex(s, "mergedlengths") as ix:
          w = ix.writer()
          w.add_document(f1=u("A B C"), f2=u("X"))
          w.add_document(f1=u("B C D E"), f2=u("Y Z"))
          w.commit()
  
          w = ix.writer()
          w.add_document(f1=u("A"), f2=u("B C D E X Y"))
          w.add_document(f1=u("B C"), f2=u("X"))
          w.commit(merge=False)
  
          w = ix.writer()
          w.add_document(f1=u("A B X Y Z"), f2=u("B C"))
          w.add_document(f1=u("Y X"), f2=u("A B"))
          w.commit(merge=False)
  
          with ix.reader() as dr:
              assert dr.stored_fields(0)["f1"] == u("A B C")
              assert dr.doc_field_length(0, "f1") == 3
              assert dr.doc_field_length(2, "f2") == 6
              assert dr.doc_field_length(4, "f1") == 5
  
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 9 for calling a global function with example usage: test_merged_lengths() without return types