Fixed #24938 -- Added PostgreSQL trigram support.

This commit is contained in:
Matthew Somerville 2015-06-05 17:37:48 +01:00 committed by Tim Graham
parent d7334b405f
commit 1962a96a30
11 changed files with 184 additions and 4 deletions

View file

@ -55,11 +55,12 @@ use :lookup:`unaccented comparison <unaccent>`::
This shows another issue, where we are matching against a different spelling of
the name. In this case we have an asymmetry though - a search for ``Helen``
will pick up ``Helena`` or ``Hélène``, but not the reverse. Another option
would be to use a trigram comparison, which compares sequences of letters.
would be to use a :lookup:`trigram_similar` comparison, which compares
sequences of letters.
For example::
>>> Author.objects.filter(name__unaccent__lower__trigram='Hélène')
>>> Author.objects.filter(name__unaccent__lower__trigram_similar='Hélène')
[<Author: Helen Mirren>, <Actor: Hélène Joy>]
Now we have a different problem - the longer name of "Helena Bonham Carter"