Full-Text Search in Django with PostgreSQL - EP2017

Full-Text Search in Django with PostgreSQL - EP2017

Demonstrating how we used Django Full-Text Search and PostgreSQL in a Real Project.

Originally presented at #EuroPython 2017 in RImini, Italy


From Django version 1.10, the potgres.search module is present, and it simplifies the use of PostgreSQL full-text search engine.The fact that PostgreSQL is used in a lot of Django based projects, using its full-text search engine, permits to use this feature in a very easy way, without having to configure external tools and not having to worry about synchronizing the data between different systems.We will view how we have used this full-text search feature in a real project.

- Full-Text Searchin Django with PostgreSQL
- Paolo Melchiorre
- Goal
- Motivation
- Agenda
- Full-Text Search
- Features of a FTS
- Tested Solutions
- Elasticsearch
- Apache Solr
- Existing Solutions
- FTS in PostgreSQL
- What are documents
- Language Support
- Django Support
- Making queries
- Standard queries
- Unaccented query
- Trigram similar
- The search lookup
- SearchVector
- SearchQuery
- SearchRank
- Search configuration
- Weighting queries
- SearchVectorField
- www.concertiaroma.com
- Version 2.0
- Version 3.0
- Band Manager
- Band Tests Setup
- Band Tests Method
- What’s next
- Conclusions
- Resources
- Acknowledgements
- Thank you
- Social Time
- Questions ?
- Contacts


After some experiences in the implementation of full-text search functionality with different system, we have decided to use PostgreSQL to implement full-text search functionality in our next project, a website to search for shows, venues, bands and festivals.

In the past, I have worked in two different projects, a mobile platform to sell and buy used items and a sport videos sharing platform, where I used two of the most currently famous full-text search software (Elasticsearch or Solr) but I had some synchronization and management problems.

After that, in my company, we searched for new Django support of full-text search PostgreSQL implementation and we decided to use it to avoid any problems that I had in the past.

I’m going to start speaking about the full-text search in a general context and I want to show the problems I encountered implementing it in the past.

Afterwards, I’m going to talk about the PostgreSQL functionality to implement the full-text search functionality and also present the django.contrib.potgres.search module, with step-by-step demonstrations of its functions with real world data.

Finally, I’m going to show the way we use and test this functionality in our project and which functionality lacks us to have a complete implementation of full-text search in our project.

At the end, I want to present my conclusions about our solution and I want to explore some new features that will be present in the next versions of Django and PostgreSQL.


Paolo Melchiorre

July 12, 2017