(self, client)
| 1376 | |
| 1377 | @pytest.mark.redismod |
| 1378 | def test_synupdate(self, client): |
| 1379 | definition = IndexDefinition(index_type=IndexType.HASH) |
| 1380 | client.ft().create_index( |
| 1381 | (TextField("title"), TextField("body")), definition=definition |
| 1382 | ) |
| 1383 | |
| 1384 | client.ft().synupdate("id1", True, "boy", "child", "offspring") |
| 1385 | client.hset("doc1", mapping={"title": "he is a baby", "body": "this is a test"}) |
| 1386 | |
| 1387 | client.ft().synupdate("id1", True, "baby") |
| 1388 | client.hset( |
| 1389 | "doc2", mapping={"title": "he is another baby", "body": "another test"} |
| 1390 | ) |
| 1391 | |
| 1392 | res = client.ft().search(Query("child").expander("SYNONYM")) |
| 1393 | if expects_resp2_shape(client) or expects_unified_shape(client): |
| 1394 | assert res.docs[0].id == "doc2" |
| 1395 | assert res.docs[0].title == "he is another baby" |
| 1396 | assert res.docs[0].body == "another test" |
| 1397 | elif expects_resp3_shape(client): |
| 1398 | assert res["results"][0]["id"] == "doc2" |
| 1399 | assert ( |
| 1400 | res["results"][0]["extra_attributes"]["title"] == "he is another baby" |
| 1401 | ) |
| 1402 | assert res["results"][0]["extra_attributes"]["body"] == "another test" |
| 1403 | |
| 1404 | @pytest.mark.redismod |
| 1405 | def test_syndump(self, client): |
nothing calls this directly
no test coverage detected