@@ -2621,6 +2621,40 @@ async def test_hybrid_search_query_with_pipeline(self, decoded_r: redis.Redis):
26212621
26222622class TestSearchWithVamana (AsyncSearchTestsBase ):
26232623 # SVS-VAMANA Async Tests
2624+ @pytest .mark .fixed_client
2625+ def test_vector_field_rerank (self ):
2626+ # Pure serialization check: VectorField builds the FT.CREATE args with
2627+ # no server round-trip, so this test needs no Redis and is not gated.
2628+ # RERANK is a boolean key-value attribute for HNSW vector fields on
2629+ # disk-backed (Flex / Auto-Tiering) deployments, where it is mandatory.
2630+ # It toggles the exact FP32 rerank pass over the approximate candidates
2631+ # returned by the on-disk graph traversal. It flows through the generic
2632+ # ``attributes`` dict as the string "TRUE"/"FALSE" (a bare flag is
2633+ # rejected by the server, and Python bools are rejected by the client
2634+ # encoder), and the attribute-count token accounts for the extra pair.
2635+ # Field construction has no I/O, so this mirrors the sync serialization
2636+ # test and is not an async test.
2637+ field = VectorField (
2638+ "v" ,
2639+ "HNSW" ,
2640+ {"TYPE" : "FLOAT32" , "DIM" : 128 , "DISTANCE_METRIC" : "L2" , "RERANK" : "TRUE" },
2641+ )
2642+ assert field .args [0 ] == "VECTOR"
2643+ assert field .args [1 ] == "HNSW"
2644+ assert field .args [2 ] == 8 # 4 attribute pairs -> 8 tokens
2645+ assert "RERANK" in field .args
2646+ assert "TRUE" in field .args
2647+
2648+ # MS2 also accepts RERANK FALSE (opt out of the rerank pass).
2649+ field = VectorField (
2650+ "v" ,
2651+ "HNSW" ,
2652+ {"TYPE" : "FLOAT32" , "DIM" : 128 , "DISTANCE_METRIC" : "L2" , "RERANK" : "FALSE" },
2653+ )
2654+ assert field .args [2 ] == 8
2655+ assert "RERANK" in field .args
2656+ assert "FALSE" in field .args
2657+
26242658 @pytest .mark .redismod
26252659 @skip_if_server_version_lt ("8.1.224" )
26262660 async def test_async_svs_vamana_basic_functionality (self , decoded_r : redis .Redis ):
0 commit comments