Create definition and test its args
(self, client)
| 1047 | @pytest.mark.redismod |
| 1048 | @skip_ifmodversion_lt("2.0.0", "search") |
| 1049 | def test_index_definition(self, client): |
| 1050 | """ |
| 1051 | Create definition and test its args |
| 1052 | """ |
| 1053 | with pytest.raises(RuntimeError): |
| 1054 | IndexDefinition(prefix=["hset:", "henry"], index_type="json") |
| 1055 | |
| 1056 | definition = IndexDefinition( |
| 1057 | prefix=["hset:", "henry"], |
| 1058 | filter="@f1==32", |
| 1059 | language="English", |
| 1060 | language_field="play", |
| 1061 | score_field="chapter", |
| 1062 | score=0.5, |
| 1063 | payload_field="txt", |
| 1064 | index_type=IndexType.JSON, |
| 1065 | ) |
| 1066 | |
| 1067 | assert [ |
| 1068 | "ON", |
| 1069 | "JSON", |
| 1070 | "PREFIX", |
| 1071 | 2, |
| 1072 | "hset:", |
| 1073 | "henry", |
| 1074 | "FILTER", |
| 1075 | "@f1==32", |
| 1076 | "LANGUAGE_FIELD", |
| 1077 | "play", |
| 1078 | "LANGUAGE", |
| 1079 | "English", |
| 1080 | "SCORE_FIELD", |
| 1081 | "chapter", |
| 1082 | "SCORE", |
| 1083 | 0.5, |
| 1084 | "PAYLOAD_FIELD", |
| 1085 | "txt", |
| 1086 | ] == definition.args |
| 1087 | |
| 1088 | self.createIndex(client.ft(), num_docs=500, definition=definition) |
| 1089 | |
| 1090 | @pytest.mark.parametrize( |
| 1091 | "prefix", |
nothing calls this directly
no test coverage detected