(self, client)
| 2640 | @skip_if_server_version_gte("7.9.0") |
| 2641 | @skip_if_server_version_lt("6.3.0") |
| 2642 | def test_profile(self, client): |
| 2643 | client.ft().create_index((TextField("t"),)) |
| 2644 | client.ft().client.hset("1", "t", "hello") |
| 2645 | client.ft().client.hset("2", "t", "world") |
| 2646 | |
| 2647 | # check using Query |
| 2648 | q = Query("hello|world").no_content() |
| 2649 | if expects_resp2_shape(client) or expects_unified_shape(client): |
| 2650 | res, det = client.ft().profile(q) |
| 2651 | det = det.info |
| 2652 | |
| 2653 | assert isinstance(det, list) |
| 2654 | assert len(res.docs) == 2 # check also the search result |
| 2655 | |
| 2656 | # check using AggregateRequest |
| 2657 | req = ( |
| 2658 | aggregations.AggregateRequest("*") |
| 2659 | .load("t") |
| 2660 | .apply(prefix="startswith(@t, 'hel')") |
| 2661 | ) |
| 2662 | res, det = client.ft().profile(req) |
| 2663 | det = det.info |
| 2664 | assert isinstance(det, list) |
| 2665 | assert len(res.rows) == 2 # check also the search result |
| 2666 | elif expects_resp3_shape(client): |
| 2667 | res = client.ft().profile(q) |
| 2668 | res = res.info |
| 2669 | |
| 2670 | assert isinstance(res, dict) |
| 2671 | assert len(res["results"]) == 2 # check also the search result |
| 2672 | |
| 2673 | # check using AggregateRequest |
| 2674 | req = ( |
| 2675 | aggregations.AggregateRequest("*") |
| 2676 | .load("t") |
| 2677 | .apply(prefix="startswith(@t, 'hel')") |
| 2678 | ) |
| 2679 | res = client.ft().profile(req) |
| 2680 | res = res.info |
| 2681 | |
| 2682 | assert isinstance(res, dict) |
| 2683 | assert len(res["results"]) == 2 # check also the search result |
| 2684 | |
| 2685 | @pytest.mark.redismod |
| 2686 | @pytest.mark.onlynoncluster |
nothing calls this directly
no test coverage detected