GeezerVison is showing github.com — fix: milvus _get_docs_by_ids (#859) · docarray/docarray@67209b8
This repository was archived by the owner on Sep 9, 2026. It is now read-only.
File treeExpand file treeCollapse file tree Open diff view settings docarray/array/storage/milvus
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: docarray/array/storage/milvus/getsetdel.py +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -74,8 +74,7 @@ def _get_docs_by_ids(self, ids: 'Iterable[str]', **kwargs) -> 'DocumentArray': | 74 | 74 | raise KeyError(f'No documents found for ids {ids}') | 75 | 75 | docs.extend(self._docs_from_query_response(res)) | 76 | 76 | # sort output docs according to input id sorting | 77 | | - id_to_index = {id_: i for i, id_ in enumerate(ids)} | 78 | | - return DocumentArray(sorted(docs, key=lambda d: id_to_index[d.id])) | | 77 | + return DocumentArray([docs[d] for d in ids]) | 79 | 78 |
| 80 | 79 | def _del_docs_by_ids(self, ids: 'Iterable[str]', **kwargs) -> 'DocumentArray': | 81 | 80 | kwargs = self._update_kwargs_from_config('consistency_level', **kwargs) | |
Collapse file Copy file name to clipboardExpand all lines: tests/unit/array/test_advance_indexing.py +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -273,12 +273,13 @@ def test_sequence_str(docs, storage, config, start_storage): | 273 | 273 | else: | 274 | 274 | docs = DocumentArray(docs, storage=storage) | 275 | 275 | # getter | 276 | | - idx = [d.id for d in docs[1, 3, 5, 7, -1, -2]] | | 276 | + idx = [d.id for d in docs[1, 3, 5, 7, -1, -2, 1]] | 277 | 277 |
| 278 | 278 | assert len(docs[idx]) == len(idx) | 279 | 279 | assert len(docs[tuple(idx)]) == len(idx) | 280 | 280 |
| 281 | 281 | # setter | | 282 | + idx = [d.id for d in docs[1, 3, 5, 7, -1, -2]] | 282 | 283 | docs[idx] = [Document(text='repl') for _ in range(len(idx))] | 283 | 284 | idx = [d.id for d in docs[1, 3, 5, 7, -1, -2]] | 284 | 285 | for _id in idx: | |
|