django-search-query¶
A reusable, Lucene-inspired search query language for Django – and an optional Django admin integration built on top of it.
Build a search registry and run a query against a Django queryset.
The search syntax, and the magic: a query string becomes a Q object and filters a queryset.
Add the core package or the admin integration to a Django project.
search_query_to_q, parse, build_q, the field registry, and the admin mixin.
The core query language and the optional admin integration.
Development setup, contributing, and the release process.
Per-package release notes.
Install¶
$ pip install django-search-query
$ uv add django-search-query
The admin integration installs separately; see Install.
What this is¶
django-search-query accepts a
structured search string and translates it into Django-compatible query
behavior, so an application gets a consistent search syntax
without committing to a particular user interface, admin integration, or
search backend. Under the hood that string becomes a
Q you hand to any
QuerySet – see Query language for the syntax and the
worked query-to-queryset examples. Its scope is intentionally loose: the
syntax is Lucene-inspired without claiming full Lucene compatibility.
django-admin-search-query is an optional add-on that brings that same structured search to Django admin changelist pages while keeping the core language usable on its own – the relationship stays loose so the core package never couples to admin behavior or presentation concerns. It also optionally ships a self-contained, vanilla-JavaScript search input with syntax highlighting, contextual suggestions, and semantic autocomplete that degrades to a plain text field when JavaScript is unavailable.