Blog / Search

How to add full-text search to your Django app (with a PostgreSQL backend)

September 25, 2017

In Django 1.10, the django.contrib.postgres.search module was added to make it really easy to use PostgreSQL's full text search engine with a Django app.

I currently use it for this blog, Remote Python's job and developer search, and our knowledge base for Highview Apps. I'm really impressed with how good the search is and how little code is needed to get it working. Unless you have huge amounts of data/traffic and need really …

Solr request returning a 400 (Bad Request) response

March 26, 2015

I was troubleshooting an issue for a client the other day where certain Solr requests were returning a 400 (Bad Request) error response. There were actually 2 separate issues:

1. The Tomcat servlet and/or the web server in front of it (in this case an HA Proxy server) can't process the request because it's too big.

2. The Solr query parameter contains too many boolean clauses (the error actually says 'too many boolean clauses').

To …

Haystack with Solr: Indexing Tips

January 22, 2015

I was troubleshooting an issue a couple of weeks ago with some of our Django views taking too long to return a response. The issue was due to post_save and post_delete signals making a request to Solr to update the index with the 'commit' parameter set to 'true' (Haystack default). This basically tells Solr to do the indexing right away (hard commit) and it was taking a few seconds to finish.

Below are some tips …

Adding basic search to your Django site

January 17, 2015

While most people probably find content on your site through Google, it might still be a good idea to just add a basic search functionality to it. You can control which fields to search, how your results are displayed, and your readers won't have to leave your site. You may also have content that is not yet public that you want to be able to search, such as unpublished articles or blog posts.

For this …