This is a simple search app. It's not a goal to make another google or to manage gazillion of documents in the database, but to have a easy to configure and intuitive to use search app for your django project.


Install django-simplesearch via pip:

$ pip install django-simplesearch


Add the sub-apps from simplesearch to your INSTALLED_APPS in the

# ...
# ...

If you want to enable the standard search and don't want to use a custom search form, add one line to your

urlpattern = pattern('',
# ...
include(r'^search', include('simplesearch.query.urls')),
# ...


Hence you use the out of the box indexer, I will explain now how to fed it. Maybe you want to do:

  • Easily fead all instances of a model.
  • Exclude some fields.
  • Exclude some instances.

In your root-urlconf, activate the indexer:

from simplesearch import index

In the file you've specified in the INDEXER_CONF variable in your (the default is indexer), you have to initialize the index:

from simplesearch import index

The easiest way to build the index is to add the whole project:


What happens now? All models from all installed apps are examined, so that all indexable fields are used for the index. There's no single field or model-instance which is excluded of the search results.

For example TextFields are indexable, BooleanFields are not.

The more fine granular step is do index a whole app:


or just:


In both cases, all models are indexed. Even more fine granular is to index a very model of an app. Therefore just write:

from myapp.models import MyModel

All indexable fields of MyModel are indexed. Even yet more fine granular is to index only a subset of fields:

from myapp.models import MyModel
index.index_model(MyModel, 'my_text_field', 'my_char_field')

After all, you can tell the index not to index something:

index.index_app('django.contrib.comments', exlude=True)

or a model:

index.index_model(MyModel, exclude=True)

or some fields:

index.index_model(MyModel, 'my_text_field', exclude=True)

Note: Not indexing something outweighs indexing something!

For example, if you want to index a whole project, but don't want to index comments of the django.contrib.comments-app, just do:

index.index_app('django.contrib.comments', exclude=True)

That's it about indexing.

Search Results

When I'm sure about indexing, I will take care about the query part.