(self, client)
| 1931 | @pytest.mark.redismod |
| 1932 | @skip_ifmodversion_lt("2.4.3", "search") |
| 1933 | def test_dialect(self, client): |
| 1934 | client.ft().create_index( |
| 1935 | ( |
| 1936 | TagField("title"), |
| 1937 | TextField("t1"), |
| 1938 | TextField("t2"), |
| 1939 | NumericField("num"), |
| 1940 | VectorField( |
| 1941 | "v", |
| 1942 | "HNSW", |
| 1943 | {"TYPE": "FLOAT32", "DIM": 1, "DISTANCE_METRIC": "COSINE"}, |
| 1944 | ), |
| 1945 | ) |
| 1946 | ) |
| 1947 | client.hset("h", "t1", "hello") |
| 1948 | with pytest.raises(redis.ResponseError) as err: |
| 1949 | client.ft().explain(Query("(*)").dialect(1)) |
| 1950 | assert "Syntax error" in str(err.value) |
| 1951 | assert "WILDCARD" in client.ft().explain(Query("(*)")) |
| 1952 | |
| 1953 | with pytest.raises(redis.ResponseError) as err: |
| 1954 | client.ft().explain(Query("$hello").dialect(1)) |
| 1955 | assert "Syntax error" in str(err.value) |
| 1956 | q = Query("$hello") |
| 1957 | expected = "UNION {\n hello\n +hello(expanded)\n}\n" |
| 1958 | assert expected in client.ft().explain(q, query_params={"hello": "hello"}) |
| 1959 | |
| 1960 | expected = "NUMERIC {0.000000 <= @num <= 10.000000}\n" |
| 1961 | assert expected in client.ft().explain(Query("@title:(@num:[0 10])").dialect(1)) |
| 1962 | with pytest.raises(redis.ResponseError) as err: |
| 1963 | client.ft().explain(Query("@title:(@num:[0 10])")) |
| 1964 | assert "Syntax error" in str(err.value) |
| 1965 | |
| 1966 | |
| 1967 | class TestAggregations(SearchTestsBase): |
nothing calls this directly
no test coverage detected