class TrigramSimilarity(expression, string, **extra)
[source]
New in Django 1.10.
Accepts a field name or expression, and a string or expression. Returns the trigram similarity between the two arguments.
Usage example:
>>> from django.contrib.postgres.search import TrigramSimilarity >>> Author.objects.create(name='Katy Stevens') >>> Author.objects.create(name='Stephen Keats') >>> test = 'Katie Stephens' >>> Author.objects.annotate( ... similarity=TrigramSimilarity('name', test), ... ).filter(similarity__gt=0.3).order_by('-similarity') [<Author: Katy Stevens>, <Author: Stephen Keats>]
Please login to continue.