diff --git a/CHANGELOG.md b/CHANGELOG.md index a756a3d..0045993 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## Unreleased +* PyLucene >=10 required ## [3.3](https://pypi.org/project/lupyne/3.3/) - 2024-10-20 * PyLucene >=9.12 required diff --git a/README.md b/README.md index 852a40b..3bc2f30 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ PyLucene is not `pip` installable. * [Homebrew](https://brew.sh) formula: `brew install coady/tap/pylucene` ## Dependencies -* PyLucene >=9.12 +* PyLucene >=10 * strawberry-graphql (if graphql option) * fastapi (if rest option) diff --git a/lupyne/engine/__init__.py b/lupyne/engine/__init__.py index d7ab7d6..4b84c63 100644 --- a/lupyne/engine/__init__.py +++ b/lupyne/engine/__init__.py @@ -12,4 +12,4 @@ from .indexers import IndexSearcher, MultiSearcher, IndexWriter, Indexer # noqa version = tuple(map(int, lucene.VERSION.split('.'))) -assert version >= (9, 12), version +assert version >= (10,), version diff --git a/lupyne/engine/documents.py b/lupyne/engine/documents.py index 430e95c..a530871 100644 --- a/lupyne/engine/documents.py +++ b/lupyne/engine/documents.py @@ -348,7 +348,7 @@ def __init__(self, searcher, scoredocs: Sequence, count=0, fields=None): self.searcher, self.scoredocs = searcher, scoredocs if hasattr(count, 'relation'): cls = int if count.relation == search.TotalHits.Relation.EQUAL_TO else float - count = cls(count.value() if lucene.VERSION.startswith('10.') else count.value) + count = cls(count.value()) self.count, self.fields = count, fields def select(self, *fields: str): @@ -450,12 +450,8 @@ def __len__(self): def __getitem__(self, index): hits = groupdocs = self.groupdocs[index] if isinstance(groupdocs, grouping.GroupDocs): - if lucene.VERSION.startswith('10.'): # pragma: no cover - hits = Hits(self.searcher, groupdocs.scoreDocs(), groupdocs.totalHits()) - hits.value = convert(groupdocs.groupValue()) - else: - hits = Hits(self.searcher, groupdocs.scoreDocs, groupdocs.totalHits) - hits.value = convert(groupdocs.groupValue) + hits = Hits(self.searcher, groupdocs.scoreDocs(), groupdocs.totalHits()) + hits.value = convert(groupdocs.groupValue()) hits.fields = self.fields return hits