From c7e61da0e6a55c2501851182b743ec4447bdab97 Mon Sep 17 00:00:00 2001 From: Benjamin Piwowarski Date: Thu, 14 Dec 2023 09:06:34 +0100 Subject: [PATCH] Use provided id_field in get_many (#252) * Use provided id_field * Fix 2 --- ir_datasets/indices/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ir_datasets/indices/base.py b/ir_datasets/indices/base.py index 5a81f25a..85d02e9e 100644 --- a/ir_datasets/indices/base.py +++ b/ir_datasets/indices/base.py @@ -17,9 +17,9 @@ def get_many(self, doc_ids, field=None): field_idx = self._doc_cls._fields.index(field) if field is not None else None for doc in self.get_many_iter(doc_ids): if field is not None: - result[doc.doc_id] = doc[field_idx] + result[getattr(doc, self._id_field)] = doc[field_idx] else: - result[doc.doc_id] = doc + result[getattr(doc, self._id_field)] = doc return result def get_many_iter(self, doc_ids):