Semantic search for Django

Vector search that
traverses your model graph

Make a Product searchable by its category__name, tags__name and brand__description β€” automatically. Sentence-transformers embeddings, pluggable vector backends, admin UI and REST API out of the box.

PyPI Python Django MIT
# ChromaDB backend (recommended for local/dev)
pip install django-graph-search[chromadb]
# or FAISS / Qdrant / pgvector / cloud embeddings
pip install django-graph-search[faiss]  # qdrant Β· pgvector Β· openai Β· cohere Β· all

Why graph search?

Most Django search solutions treat each model in isolation. Django Graph Search builds rich search context by walking the ORM relation graph before indexing.

πŸ•ΈοΈ

Graph-aware indexing

Follows FK, M2M and reverse relations to a configurable depth, with per-field weights and traversal limits (MAX_RELATED_ITEMS, MAX_TEXT_LENGTH).

🌐

Multilingual semantics

Sentence-transformers embeddings out of the box; OpenAI and Cohere cloud embeddings when you don't want PyTorch in your workers.

πŸ”Œ

Pluggable backends

ChromaDB, FAISS, Qdrant, pgvector β€” one interface, upsert semantics everywhere. Switch with a single settings key.

⚑

Transaction-safe auto-index

Signals dispatch via transaction.on_commit into a bounded daemon thread pool, Celery or django-q β€” requests never block.

🧭

Admin & REST included

Semantic search inside /admin/, index-coverage dashboard, and a REST API with permissions, throttling and streaming.

πŸ’¬

Conversational & LangGraph

Optional session-aware search with clarification loops, query expansion, reranking and SSE/NDJSON event streaming.

Quickstart

Three steps to semantic search across your models.

# 1. settings.py
INSTALLED_APPS = [ ..., "django_graph_search" ]

GRAPH_SEARCH = {
    "MODELS": [
        {"model": "shop.Product",
         "fields": ["name", "description", "category__name", "tags__name"]},
    ],
    "VECTOR_STORE": {
        "BACKEND": "django_graph_search.backends.ChromaDBBackend",
        "OPTIONS": {"persist_directory": "vector_db"},
    },
}

# 2. urls.py
urlpatterns = [ path("api/search/", include("django_graph_search.urls")) ]

# 3. build the index and query
$ python manage.py build_search_index
$ curl "http://localhost:8000/api/search/?q=red+phone&limit=5"

Supported backends

Same API, same document format β€” pick per environment. All backends re-index with upsert semantics since 0.3.4.

BackendBest forServer required
ChromaDBDevelopment, small-medium datasetsNo
FAISSHigh-speed CPU search, offline, optional disk persistenceNo
QdrantProduction, large datasets, filteringYes
pgvectorSame PostgreSQL as Django, no separate vector serverPostgreSQL + vector

What's new in 0.3.4

Reliability & security hardening β€” fully backward-compatible with 0.3.x.

Full release notes β†’