(self, decoded_r: redis.Redis)
| 141 | class TestBaseSearchFunctionality(AsyncSearchTestsBase): |
| 142 | @pytest.mark.redismod |
| 143 | async def test_client(self, decoded_r: redis.Redis): |
| 144 | num_docs = 500 |
| 145 | await self.createIndex(decoded_r.ft(), num_docs=num_docs) |
| 146 | await self.waitForIndex(decoded_r, "idx") |
| 147 | # verify info |
| 148 | info = await decoded_r.ft().info() |
| 149 | for k in [ |
| 150 | "index_name", |
| 151 | "index_options", |
| 152 | "attributes", |
| 153 | "num_docs", |
| 154 | "max_doc_id", |
| 155 | "num_terms", |
| 156 | "num_records", |
| 157 | "inverted_sz_mb", |
| 158 | "offset_vectors_sz_mb", |
| 159 | "doc_table_size_mb", |
| 160 | "key_table_size_mb", |
| 161 | "records_per_doc_avg", |
| 162 | "bytes_per_record_avg", |
| 163 | "offsets_per_term_avg", |
| 164 | "offset_bits_per_record_avg", |
| 165 | ]: |
| 166 | assert k in info |
| 167 | |
| 168 | assert decoded_r.ft().index_name == info["index_name"] |
| 169 | assert num_docs == int(info["num_docs"]) |
| 170 | |
| 171 | res = await decoded_r.ft().search("henry iv") |
| 172 | if expects_resp2_shape(decoded_r) or expects_unified_shape(decoded_r): |
| 173 | assert isinstance(res, Result) |
| 174 | assert 225 == res.total |
| 175 | assert 10 == len(res.docs) |
| 176 | assert res.duration > 0 |
| 177 | |
| 178 | for doc in res.docs: |
| 179 | assert doc.id |
| 180 | assert doc.play == "Henry IV" |
| 181 | assert len(doc.txt) > 0 |
| 182 | |
| 183 | # test no content |
| 184 | res = await decoded_r.ft().search(Query("king").no_content()) |
| 185 | assert 194 == res.total |
| 186 | assert 10 == len(res.docs) |
| 187 | for doc in res.docs: |
| 188 | assert "txt" not in doc.__dict__ |
| 189 | assert "play" not in doc.__dict__ |
| 190 | |
| 191 | # test verbatim vs no verbatim |
| 192 | total = (await decoded_r.ft().search(Query("kings").no_content())).total |
| 193 | vtotal = ( |
| 194 | await decoded_r.ft().search(Query("kings").no_content().verbatim()) |
| 195 | ).total |
| 196 | assert total > vtotal |
| 197 | |
| 198 | # test in fields |
| 199 | txt_total = ( |
| 200 | await decoded_r.ft().search( |
nothing calls this directly
no test coverage detected