Skip to main content
django-simplesearch
============

A reusable [Django](http://www.djangoproject.com/) application for simple searching, based on [Julien Phalip's original code](http://julienphalip.com/post/2825034077/adding-search-to-a-django-site-in-a-snap>).


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](https://en.wikipedia.org/wiki/Stop_words). The `get_query` function then returns a [Q object](https://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects) which may be used to search the given fields for the given term.


Installation
------------

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 setup.py install


Setup
-----

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


Usage
-----

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`.

Metadata

Release files for django-simplesearch 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-simplesearch 1.0
File Size Uploaded Provenance Actions
django-simplesearch-1.0.tar.gz 3.7 kB Without provenance Details for django-simplesearch-1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-simplesearch 1.0
File Interpreter ABI Platform Actions
django_simplesearch-1.0-py2.7.egg Legacy Egg format - - Details for django_simplesearch-1.0-py2.7.egg

Total release size: 10.2 kB

Release files / django-simplesearch-1.0.tar.gz

Download URL django-simplesearch-1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
14fd1fce291d221ce9b58ca98be9931d82e74bb39aeff7d5247f1c47c0ff7049
BLAKE2b-256 checksum
How to use checksums
030df98ffe575efc94dc1e9cc13629c113f4a6876bc6880d86eacfdb764ac14a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_simplesearch-1.0-py2.7.egg

Download URL django_simplesearch-1.0-py2.7.egg
Size 6.5 kB
Tags Egg
SHA-256 checksum
How to use checksums
4dd55612ffd0164a971abbac59337795140a876bb06a38da9aa9bee28c00c287
BLAKE2b-256 checksum
How to use checksums
d42d1a90462b8ac5300e45458a10e686df8a3522e4dfedaf17cdef1f838b3b87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-simplesearch 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

1.0 This release

2 release files No provenance

0.1

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