Pythonic search engine based on PyLucene.
Project description
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.
Usage
PyLucene requires initializing the VM.
import lucene
lucene.initVM()
Indexes are accessed through an IndexSearcher
(read-only), IndexWriter
, or the combined Indexer
.
from lupyne import engine
searcher = engine.IndexSearcher('index/path')
hits = searcher.search('text:query')
See ./lupyne/services/README.md
for services usage.
Installation
% pip install lupyne[graphql,rest]
PyLucene is not pip
installable.
- Install instructions
- Docker image:
docker pull coady/pylucene
- Homebrew formula:
brew install coady/tap/pylucene
Dependencies
- PyLucene >=9.12
- strawberry-graphql (if graphql option)
- fastapi (if rest option)
Tests
100% branch coverage.
% pytest [--cov]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file lupyne-3.3.tar.gz
.
File metadata
- Download URL: lupyne-3.3.tar.gz
- Upload date:
- Size: 34.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d231896754041c67cf8276a2e23a713fad53740ed1919e750c53cbff9305229 |
|
MD5 | 7d87e0562247e2442ca10fc102c95bea |
|
BLAKE2b-256 | 51470dee77ff14422116323d68df05e8ca52a26d8d5160d804c78313001f0089 |
File details
Details for the file lupyne-3.3-py3-none-any.whl
.
File metadata
- Download URL: lupyne-3.3-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f92efff08926a5691ab5d4b81d128f12569d4c8c8016c0dc7332a1cdb3a5662e |
|
MD5 | a59c324b61c0fa1f0cf5ba1611f94080 |
|
BLAKE2b-256 | 88bb214ce3452e6d4facbf0f02927afc7dbbded80e8a74f495fe0f1a77df41e7 |