Pythonic search engine based on PyLucene.
Lupyne is a search engine based on PyLucene, the Python extension for accessing Java Lucene. Lucene is a relatively low-level toolkit, and PyLucene wraps it through automatic code generation. So although Java idioms are translated to Python idioms where possible, the resulting interface is far from Pythonic. See
./docs/examples.ipynb for comparisons with the Lucene API.
Lupyne also provides GraphQL and RESTful search services, based on Starlette. Note Solr and Elasticsearch are popular options for Lucene-based search, if no further (Python) customization is needed. So while the services are suitable for production usage, their primary motivation is to be an extensible example.
Not having to initially choose between an embedded library and a server not only provides greater flexibility, it can provide better performance, e.g., batch indexing offline and remote searching live. Additionally only lightweight wrappers with extended behavior are used wherever possible, so falling back to using PyLucene directly is always an option, but should never be necessary for performance.
PyLucene requires initializing the VM.
import lucene lucene.initVM()
Indexes are accessed through an
IndexWriter, or the combined
from lupyne import engine searcher = engine.IndexSearcher('index/path') hits = searcher.search('text:query')
./lupyne/services/README.md for services usage.
% pip install lupyne[graphql,rest]
PyLucene is not
- Install instructions
- Docker image:
docker pull coady/pylucene
- Homebrew formula:
brew install coady/tap/pylucene
- PyLucene >=8
- strawberry-graphql >=0.30 (if graphql option)
- fastapi (if rest option)
100% branch coverage.
% pytest [--cov]
- Python >=3.7 required
- PyLucene 8.6 supported
- CherryPy server deprecated
- PyLucene >=8 required
- PyLucene >=7.7 required
- PyLucene 8 supported
- PyLucene 7.6 supported
- PyLucene >=7 required
- PyLucene >=6 required
- Python 3 support
- client moved to external package
- Python 2.6 dropped
- PyLucene 4.8 and 4.9 dropped
- IndexWriter implements context manager
- Server DocValues updated via patch method
- Spatial tile search optimized
- PyLucene 4.10 supported
- PyLucene 4.6 and 4.7 dropped
- Comparator iteration optimized
- Support for string based FieldCacheRangeFilters
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size lupyne-2.5-py3-none-any.whl (36.5 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size lupyne-2.5.tar.gz (735.7 kB)||File type Source||Python version None||Upload date||Hashes View|