Skip to main content

django-pitchfork

Full-text search for Django, powered by Rust. django-pitchfork is a drop-in replacement for django-haystack: the same public API your templates, views and management commands already speak — SearchQuerySet, SearchIndex, fields, inputs, views, forms, templatetags, management commands — backed by a fast Rust/Tantivy engine instead of Python-only indexes.

It is the Django-facing search layer on top of pitchfork-engine (the search engine itself: a standalone Tantivy-backed HTTP server, a PyO3 in-process extension, and the haystack backend machinery).

Why

  • Same API, faster core. Your code keeps using the haystack API; queries and indexing run against Rust's Tantivy (GIL released, native query AST).
  • Escape hatch from unmaintained backends. Upstream haystack's Elasticsearch support tracks ES 7 only; here every backend is tested against a live fixture in CI, and gaps are documented, not silent.
  • One-way dependency. django_pitchfork imports pitchfork (the engine); the engine never imports the replacement.

Backends

Backend Transport Notes
pitchfork (native) HTTP server or in-process PyO3 The perf baseline; Rust/Tantivy
Whoosh file-based index No service needed
Solr HTTP (pysolr) Solr 6 fixture semantics; managed-schema generation
Elasticsearch HTTP (elasticsearch-py) 7.x tested; 8.x is a documented gap
Xapian in-process bindings Bindings not on PyPI — install from your distro

Each backend ships with a capability contract (caps module) and a generated support matrix (docs/backend_support.md) so documented features are never hand-written claims. Every backend is covered by the shared conformance suite (conformance/run.py) against live fixtures.

Quick start

# settings.py
PITCHFORK_CONNECTIONS = {
    "default": {
        "ENGINE": "django_pitchfork.backends.pitchfork.PitchforkEngine",
        "URL": "http://127.0.0.1:8117/",   # the pitchfork-server fixture
    },
}
# myapp/search_indexes.py
from django_pitchfork import indexes

class NoteIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.CharField(document=True)
    title = indexes.CharField(model_attr="title")

    def get_model(self):
        return Note
python manage.py rebuild_index
python manage.py haystack_info
from django_pitchfork.query import SearchQuerySet

results = SearchQuerySet().filter(content="haystack").order_by("-pub_date")

Install:

python -m pip install "django-pitchfork"                 # core (engine included)
python -m pip install "django-pitchfork[whoosh]"         # Whoosh
python -m pip install "django-pitchfork[solr]"           # pysolr
python -m pip install "django-pitchfork[elasticsearch]"  # ES 7.x client

Xapian: no extra — the python-xapian bindings are not on PyPI. Install them from your distro (libxapian-dev + python3-xapian) and the backend picks them up (or use the xapian-capable image in docker/xa/).

The engine repo has the full quick start for the server and embedded transports: https://gitlab.com/co-plus-plus/pitchfork-engine/

Migrating from django-haystack

Mechanical import-sed (haystack. → django_pitchfork.) is the primary path — every public haystack module has a same-named counterpart, and the legacy HAYSTACK_* setting names keep working. See MIGRATION.md.

For in-progress migrations an explicit-use compat shim mirrors haystack's import surface (parity-tested against a frozen list of haystack's public names, with live parity enforced when haystack is installed as a dev dep):

import django_pitchfork.compat.haystack as haystack

The shim is never installed as haystack — that name collides with the real distribution.

Docs & benchmarks

  • Sphinx docs: docs/ (sphinx-build -W -b html docs/ docs/_build/).
  • Conformance-suite baselines per backend: BENCHMARK.md.

License

BSD-3-Clause. The haystack API surface it replaces is also BSD-3-Clause (django-haystack).

Metadata

Release files for django-pitchfork 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-pitchfork 0.1.0
File Size Uploaded Provenance Actions
django_pitchfork-0.1.0.tar.gz 112.4 kB Without provenance Details for django_pitchfork-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-pitchfork 0.1.0
File Interpreter ABI Platform Actions
django_pitchfork-0.1.0-py3-none-any.whl Python 3 none any Details for django_pitchfork-0.1.0-py3-none-any.whl

Total release size: 211.5 kB

Release files / django_pitchfork-0.1.0.tar.gz

Download URL django_pitchfork-0.1.0.tar.gz
Size 112.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a1f90b7bef2fc221a5629dea5eecdd34ae5d7593c85b9b208bc188fe46b81f11
BLAKE2b-256 checksum
How to use checksums
e1dc591f23bcac75c4a6a394f07e72f2cdece1a1faadb94f6ebdcdf0a7f0823d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / django_pitchfork-0.1.0-py3-none-any.whl

Download URL django_pitchfork-0.1.0-py3-none-any.whl
Size 99.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
29d1db1f2890fd1dc3e9373b99cbcbb3d18e26c91e2a9dfff52c4f9ba0f432e0
BLAKE2b-256 checksum
How to use checksums
60cec0d3a370cffa38a1eb4b5da7199a67f5f6d088263093057b72fe20d61493
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for django-pitchfork 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page