postgres-fts-backend
A Django Haystack backend that uses PostgreSQL's built-in full-text search. No external search service required.
Requirements
- Python >= 3.12
- Django >= 5.0
- django-haystack >= 2.8.0
- PostgreSQL
Installation
pip install postgres-fts-backend
Add to INSTALLED_APPS:
INSTALLED_APPS = [
"django.contrib.postgres",
"haystack",
"postgres_fts_backend",
# ...
]
Set a migration module so the generated search index migrations live in your project rather than inside the installed package:
MIGRATION_MODULES = {
"postgres_fts_backend": "myapp.search_migrations",
}
Configure Haystack:
HAYSTACK_CONNECTIONS = {
"default": {
"ENGINE": "postgres_fts_backend.PostgresFTSEngine",
},
}
To use a search configuration other than "english":
HAYSTACK_CONNECTIONS = {
"default": {
"ENGINE": "postgres_fts_backend.PostgresFTSEngine",
"SEARCH_CONFIG": "spanish",
},
}
Other Peculiarities of this backend
Build indexes through models and migrations
python manage.py build_postgres_schema
python manage.py migrate postgres_fts_backend
Run these two commands again whenever you change a SearchIndex definition.
Fuzzy search
Fuzzy queries use PostgreSQL's trigram similarity matching (pg_trgm):
results = SearchQuerySet().filter(author__fuzzy="Janee")
The similarity threshold is controlled by PostgreSQL's
pg_trgm.similarity_threshold setting (default 0.3). To adjust it:
ALTER DATABASE mydb SET pg_trgm.similarity_threshold = 0.5;
more_like_this not implemented
PostgreSQL FTS doesn't provide any facilities for this. It could be done, but I just need to think more about it.
spelling_suggestions are not supported
Metadata
Release files for postgres-fts-backend 0.0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| postgres_fts_backend-0.0.14.tar.gz | 42.8 kB | With provenance | Details for postgres_fts_backend-0.0.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| postgres_fts_backend-0.0.14-py3-none-any.whl | Python 3 | none | any | Details for postgres_fts_backend-0.0.14-py3-none-any.whl |
Total release size: 61.7 kB
Release files / postgres_fts_backend-0.0.14.tar.gz
| Download URL | postgres_fts_backend-0.0.14.tar.gz |
|---|---|
| Size | 42.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4beca96f8202bbe4267733cc11f0341c79d5099c5e200bbdbce818176be1dcaf
|
|
BLAKE2b-256 checksum How to use checksums |
c194ed369dfc74bc6390f2479f6bff9b7c37df852480d45d2ecb867e5f7727cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logRelease files / postgres_fts_backend-0.0.14-py3-none-any.whl
| Download URL | postgres_fts_backend-0.0.14-py3-none-any.whl |
|---|---|
| Size | 18.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8295ab9c3a46c748a5d1e988eb782feb028837d1ec981d96aa9ad01b1155cd72
|
|
BLAKE2b-256 checksum How to use checksums |
bda6cc319c61676331d1305c3ab86083c19d912f39272de17fe56de893fb6d59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logSecurity for postgres-fts-backend 0.0.14
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for postgres_fts_backend-0.0.14.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.
Transparency logA 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.