I'm Ross. These are my blog posts tagged fulltext.

Full-text searching in Django with PostgreSQL and tsearch2

Posted 7:01 p.m., Wednesday 28 January, 2009. Tagged fulltext, searching, django and tutorial

Recently, I have wanted to improve the searching ability in a number of my Django projects. I've often added a search box that simply does an icontains filter, which works fine for small sites but doesn't scale due to the inefficiency of matching text with basic SQL queries. The plus side of an icontains filter is that it works on all of Django's database backends (with the exception of SQLite, which works but in a case-sensitive way), so it can be useful for pluggable applications to implement. I wanted something that could do some heavier lifting, so I looked into tsearch2 - a PostgreSQL plugin that provides full-text indexing and searching that's twice as fast as standard icontains filters. On DjangoSites I managed to reduce my search queries to half their original time, with improved accuracy. Read the full article to find out how.


Want to see more? Check out the yearly archives below.