(self, client)
| 615 | |
| 616 | @pytest.mark.redismod |
| 617 | def test_no_index(self, client): |
| 618 | client.ft().create_index( |
| 619 | ( |
| 620 | TextField("field"), |
| 621 | TextField("text", no_index=True, sortable=True), |
| 622 | NumericField("numeric", no_index=True, sortable=True), |
| 623 | GeoField("geo", no_index=True, sortable=True), |
| 624 | TagField("tag", no_index=True, sortable=True), |
| 625 | ) |
| 626 | ) |
| 627 | |
| 628 | client.hset( |
| 629 | "doc1", |
| 630 | mapping={ |
| 631 | "field": "aaa", |
| 632 | "text": "1", |
| 633 | "numeric": "1", |
| 634 | "geo": "1,1", |
| 635 | "tag": "1", |
| 636 | }, |
| 637 | ) |
| 638 | client.hset( |
| 639 | "doc2", |
| 640 | mapping={ |
| 641 | "field": "aab", |
| 642 | "text": "2", |
| 643 | "numeric": "2", |
| 644 | "geo": "2,2", |
| 645 | "tag": "2", |
| 646 | }, |
| 647 | ) |
| 648 | self.waitForIndex(client, getattr(client.ft(), "index_name", "idx")) |
| 649 | |
| 650 | if expects_resp2_shape(client) or expects_unified_shape(client): |
| 651 | res = client.ft().search(Query("@text:aa*")) |
| 652 | assert 0 == res.total |
| 653 | |
| 654 | res = client.ft().search(Query("@field:aa*")) |
| 655 | assert 2 == res.total |
| 656 | |
| 657 | res = client.ft().search(Query("*").sort_by("text", asc=False)) |
| 658 | assert 2 == res.total |
| 659 | assert "doc2" == res.docs[0].id |
| 660 | |
| 661 | res = client.ft().search(Query("*").sort_by("text", asc=True)) |
| 662 | assert "doc1" == res.docs[0].id |
| 663 | |
| 664 | res = client.ft().search(Query("*").sort_by("numeric", asc=True)) |
| 665 | assert "doc1" == res.docs[0].id |
| 666 | |
| 667 | res = client.ft().search(Query("*").sort_by("geo", asc=True)) |
| 668 | assert "doc1" == res.docs[0].id |
| 669 | |
| 670 | res = client.ft().search(Query("*").sort_by("tag", asc=True)) |
| 671 | assert "doc1" == res.docs[0].id |
| 672 | elif expects_resp3_shape(client): |
| 673 | res = client.ft().search(Query("@text:aa*")) |
| 674 | assert 0 == res["total_results"] |
nothing calls this directly
no test coverage detected