(count)
| 214 | assert all(result.ok() for result in results) |
| 215 | |
| 216 | def assert_searchable(count): |
| 217 | # Check both the trained segment and every subsequent raw-only block. |
| 218 | for i in [0, *range(initial_count, count)]: |
| 219 | hits = collection.query( |
| 220 | Query("dense", vector=vectors[i].tolist(), param=query_param()), |
| 221 | topk=1, |
| 222 | include_vector=True, |
| 223 | ) |
| 224 | assert [hit.id for hit in hits] == [str(i)] |
| 225 | assert hits[0].vectors["dense"] == vectors[i].tolist() |
| 226 | if use_refiner: |
| 227 | assert hits[0].score == pytest.approx(0.0, abs=1e-5) |
| 228 | |
| 229 | # Exhaustive recall also verifies block offsets and result merging. |
| 230 | query = Query( |
| 231 | "dense", vector=vectors[0].tolist(), param=query_param(is_linear=True) |
| 232 | ) |
| 233 | hits = collection.query(query, topk=count) |
| 234 | assert len(hits) == count |
| 235 | assert {hit.id for hit in hits} == {str(i) for i in range(count)} |
| 236 | hits = collection.query(query, topk=count, filter="ordinal >= 128") |
| 237 | assert len(hits) == count - initial_count |
| 238 | assert {hit.id for hit in hits} == {str(i) for i in range(initial_count, count)} |
| 239 | |
| 240 | try: |
| 241 | insert(0, initial_count) |
no test coverage detected