Skip to content

Commit

Permalink
PyLucene >=10 required.
Browse files Browse the repository at this point in the history
  • Loading branch information
coady committed Oct 20, 2024
1 parent 4f2532e commit 21a97e7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion lupyne/engine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 3 additions & 7 deletions lupyne/engine/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 21a97e7

Please sign in to comment.