[Answered ]-Django TrigramSimilarity error for searches

1๐Ÿ‘

Is there a way to import similarity?

The error is not raised by Django, or at least not directly. TrigramSimilarity maps to the similarity function in PostgreSQL.

This function is defined in the pg_trgm module, which you need to enable. You do this in the database with:

CREATE EXTENSION pg_trgm;

It is possible that you will need to install the logic behind it. For Debian-like systems, you do this with:

sudo apt-get install postgresql-contrib

Leave a comment