Advertisement
Top

Django 1.10 Brings Full Text Search for PostgreSQL

August 10, 2016

Via: InfoQ

Version 1.10 of Django has been released, bringing full text search for PostgreSQL, official support for Unicode usernames and new-style middleware.

The major release for Django Software Foundation’s dynamic language includes using database functions in the django.contrib.postgres.search module to ease the use of PostgreSQL’s full text search engine.

The team provides the following example of using a simple search against a single column in the database:

>> Entry.objects.filter(body_text__search=’Cheese’)
[<Entry: Cheese on Toast recipes>, <Entry: Pizza Recipes>]

“Creating a to_tsvector in the database from the body_text field and a plainto_tsquery from the search term ‘Cheese’, both using the default database search configuration. The results are obtained by matching the query and the vector. To use the search lookup, ‘django.contrib.postgres’ must be in your INSTALLED_APPS.”

Read More on InfoQ