Skip to content

Commit

Permalink
Update _impact_searcher.py to use renamed java functions. (#1619)
Browse files Browse the repository at this point in the history
castorini/anserini@e475cc4 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'
```
  • Loading branch information
sahel-sh authored Sep 5, 2023
1 parent 9cdb29f commit d8dc5b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyserini/search/lucene/_impact_searcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d8dc5b3

Please sign in to comment.