Screenshot 2015-11-07 15.28.34

PostgreSQL mostly known as Postgres, is one of the most mature and robust databases out there. It’s a multi-platform, open source and the second most used open source DBMS.

Today we will see about how to implement a basic autocomplete search using a trigram in Postgres and Rails. The tutorial is split into three parts:

  1. What is a trigram?
  2. Trigram in Postgres
  3. Implementing trigram in a sample rails app

What is a Trigram?

A trigram is nothing but an n-gram with three letter sequence. So, what is an n-gram? From wikipedia,

In the fields of computational linguistics and probability, an n-gram is a contiguous sequence of n items from a given sequence of text or speech.

Continue reading %Awesome Autocomplete: Trigram Search in Rails and PostgreSQL%

Source: SitePoint

By Vinoth