Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A basic search application for Django.

Project description


A reusable [Django]( application for simple searching, based on [Julien Phalip's original code](>).

How it Works

A string of search terms are passed to the `get_query` function, along with a list of the model fields to search. These terms are normalized by `normalize_query`, which splits the query string into individual keyword, keeping quoted words together and removing [stop words]( The `get_query` function then returns a [Q object]( which may be used to search the given fields for the given term.


django-simplesearch is available on PyPI and can be installed with PIP.

pip install django-simplesearch

Alternatively, you may download the source and install it.

python install


Add `simplesearch` to your `settings.INSTALLED_APPS`.


django-simplesearch was created to search blog posts. To search a model `Post` in the fields `title` and `body` based on a search query submitted by a form to HTTP GET, you might do something like this:

if 'q' in request.GET:
query_string = request.GET['q']
entry_query = get_query(query_string, ['title', 'body'])
results = Post.objects.published().filter(entry_query).distinct()

In this case, the `Post` objects that matched the search query is stored within `results`.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-simplesearch, version 1.0
Filename, size File type Python version Upload date Hashes
Filename, size django_simplesearch-1.0-py2.7.egg (6.5 kB) File type Egg Python version 2.7 Upload date Hashes View
Filename, size django-simplesearch-1.0.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page