From d8dc5b3a1f32fd5d0cebeb711ba148ea967fadbe Mon Sep 17 00:00:00 2001 From: Sahel Sharify Date: Tue, 5 Sep 2023 14:36:41 -0400 Subject: [PATCH] Update _impact_searcher.py to use renamed java functions. (#1619) https://github.com/castorini/anserini/commit/e475cc4e885f5fbb223533d75a2da7abaa618c6c renames `document/documentByField` functions to `doc/doc_by_field`. This cl changes the function calls in _impact_searcher.py to match the new names to fix the following error: ```` File ".../lib/python3.10/site-packages/pyserini/search/lucene/_impact_searcher.py", line 248, in doc lucene_document = self.object.document(docid) AttributeError: 'io.anserini.search.SimpleImpactSearcher' object has no attribute 'document' ``` --- pyserini/search/lucene/_impact_searcher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyserini/search/lucene/_impact_searcher.py b/pyserini/search/lucene/_impact_searcher.py index 4782c61b5..ba77e8cd6 100644 --- a/pyserini/search/lucene/_impact_searcher.py +++ b/pyserini/search/lucene/_impact_searcher.py @@ -243,7 +243,7 @@ def doc(self, docid: Union[str, int]) -> Optional[Document]: Document :class:`Document` corresponding to the ``docid``. """ - lucene_document = self.object.document(docid) + lucene_document = self.object.doc(docid) if lucene_document is None: return None return Document(lucene_document) @@ -356,7 +356,7 @@ def doc_by_field(self, field: str, q: str) -> Optional[Document]: Document :class:`Document` whose ``field`` is ``id``. """ - lucene_document = self.object.documentByField(field, q) + lucene_document = self.object.doc_by_field(field, q) if lucene_document is None: return None return Document(lucene_document)