Skip to main content

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(), and filter() 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.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xapian_model-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file xapian_model-0.1.0.tar.gz.

File metadata

  • Download URL: xapian_model-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for xapian_model-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3d8e893d92df6a96233adaceb46e6b88920d5278d2056aecee0a4f9330b23120
MD5 09e97108fe7cd7a4ba7409c4608a9b88
BLAKE2b-256 e063237156d70a8d55fb203bf187dded839259de925678957c99b5f11f77a44b

See more details on using hashes here.

File details

Details for the file xapian_model-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xapian_model-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for xapian_model-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29894d6758f83eb6746c85d6a974d1cca774818225e5d50749b53e95694aeb71
MD5 4cfaf368e65215316eb568e10870808c
BLAKE2b-256 73de202f277de5f5cce3eb59c3418ee2eb08e73a1f49c188c404c40b40de9b4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page