

def test_vector_postings(self):
    s = fields.Schema(id=fields.ID(stored=True, unique=True), content=fields.TEXT(vector=fields.Positions(analyzer=analysis.StandardAnalyzer())))
    st = store.RamStorage()
    ix = index.Index(st, s, create=True)
    writer = ix.writer()
    writer.add_document(id='1', content='the quick brown fox jumped over the lazy dogs')
    writer.commit()
    dr = ix.doc_reader()
    terms = list(dr.vector_as(0, 0, 'weight'))
    self.assertEqual(terms, [('brown', 1.0), ('dogs', 1.0), ('fox', 1.0), ('jumped', 1.0), ('lazy', 1.0), ('over', 1.0), ('quick', 1.0)])

dataset/ETHPy150Open tallstreet/Whoosh-AppEngine/tests/test_reading.py TestReading.test_vector_postings/original