A generic Python ORM-like base class for building models backed by Xapiand
Project description
xapian_model
A generic Python ORM-like base class for building models backed by Xapiand, a distributed search engine. Part of the Dubalu Framework.
Features
- BaseXapianModel — Base class with attribute interception, save/delete operations, and template-based dynamic index naming.
- Manager — Descriptor-based manager providing
create(),get(), andfilter()query methods. - SearchResults — Dataclass wrapping search results with total counts and aggregations.
- Schema auto-provisioning — Automatically provisions the schema on first write.
Installation
pip install xapian-model
Dependencies
Install the pyxapiand client library:
pip install pyxapiand
Quick Start
from xapian_model.base import BaseXapianModel
class Product(BaseXapianModel):
INDEX_TEMPLATE = "products/{store_id}"
SCHEMA = {
"name": {"_type": "text"},
"price": {"_type": "float"},
"active": {"_type": "boolean", "_default": True},
}
# Create a product
product = Product.objects.create(store_id="store1", name="Widget", price=9.99)
# Retrieve by ID
product = Product.objects.get(id="abc123", store_id="store1")
# Search
results = Product.objects.filter(query="widget", store_id="store1", limit=10)
for item in results.results:
print(item.name, item.price)
# Update and save
product.price = 12.99
product.save()
# Delete
product.delete()
Requirements
- Python 3.12+
- Xapiand server and client library
License
MIT — Copyright (c) 2026 Dubalu International
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xapian_model-0.2.0.tar.gz
(9.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xapian_model-0.2.0.tar.gz.
File metadata
- Download URL: xapian_model-0.2.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ec88c14af570e1c3b306d9d11bd70e3a65eb0e7187ff6a4ab9f35c70f5f2b6c
|
|
| MD5 |
b69db8af2ab0c3f63ed6a21d5d2f5dd3
|
|
| BLAKE2b-256 |
66b2ab527b4df9eb4620180a8890ae33a25d7d4bc4fb59661f5947c2f4748968
|
File details
Details for the file xapian_model-0.2.0-py3-none-any.whl.
File metadata
- Download URL: xapian_model-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a6138c2d7127255dc3c074c8aa23b0b51e28521911139de67713861f27004c7
|
|
| MD5 |
9c9d633e49ce99974c2d2a274e874576
|
|
| BLAKE2b-256 |
32b24e70b2a6eaec1d11ede9da5630c770c1ab15ca9e0645aa7d2f9408487794
|