Skip to content

Commit a6864e3

Browse files
authored
[2.8] Fix Max Frequency Misscalculation - [MOD-8158] (#5560)
Fix Max Frequency Misscalculation - [MOD-8158] (#5553) * fix unrelated test * add a failing test * fix issue * revert whitespace change from test_vecsim.py * revert whitespace change in test_issues.py (cherry picked from commit b398d93)
1 parent 1f6ce2e commit a6864e3

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/document.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,6 @@ FIELD_PREPROCESSOR(vectorPreprocessor) {
676676
fs->vectorOpts.expBlobSize);
677677
return -1;
678678
}
679-
aCtx->fwIdx->maxFreq++;
680679
return 0;
681680
}
682681

tests/pytests/test_issues.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,13 @@ def test_mod_6783(env:Env):
13001300
res = env.cmd('FT.SEARCH', 'idx', '*', 'SORTBY', f'f{i}', 'NOCONTENT')
13011301
env.assertEqual(res, expected[i], message=f'Failed on field f{i} with {n_sortables} sortables')
13021302

1303+
@skip(cluster=True)
1304+
def test_mod_8589(env:Env):
1305+
env.expect('FT.CREATE', 'idx', 'SCHEMA', 't', 'TEXT', 'v', 'VECTOR', 'FLAT', '6', 'TYPE', 'FLOAT32', 'DIM', '2', 'DISTANCE_METRIC', 'L2').ok()
1306+
env.cmd('HSET', 'doc1', 'v', '????????', 't', 'foo bar foo') # Max frequency is 2 (foo)
1307+
docinfo = to_dict(env.cmd(debug_cmd(), 'DOCINFO', 'idx', 'doc1'))
1308+
env.assertEqual(docinfo['max_freq'], 2)
1309+
13031310
@skip(cluster=True)
13041311
def test_mod_8568(env:Env):
13051312
env.expect('FT.CREATE', 'idx', 'SCHEMA', 'g', 'GEO').ok()

tests/pytests/test_vecsim.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,12 +786,12 @@ def test_hybrid_query_batches_mode_with_tags():
786786

787787
for data_type in VECSIM_DATA_TYPES:
788788
conn.execute_command('FT.CREATE', 'idx', 'SCHEMA', 'v', 'VECTOR', 'HNSW', '8', 'TYPE', data_type,
789-
'DIM', dim, 'DISTANCE_METRIC', 'L2', 'EF_RUNTIME', 100, 'tags', 'TAG')
789+
'DIM', dim, 'DISTANCE_METRIC', 'L2', 'EF_RUNTIME', 100, 'tags', 'TAG', 'text', 'TEXT')
790790

791791
p = conn.pipeline(transaction=False)
792792
for i in range(1, index_size+1):
793793
vector = create_np_array_typed([i]*dim, data_type)
794-
p.execute_command('HSET', i, 'v', vector.tobytes(), 'tags', 'hybrid')
794+
p.execute_command('HSET', i, 'v', vector.tobytes(), 'tags', 'hybrid', 'text', 'text')
795795
p.execute()
796796

797797
query_data = create_np_array_typed([index_size/2]*dim, data_type)

0 commit comments

Comments
 (0)