I can't get the PostgreSQL Full Text Search feature to work as I need it.
I have a model Verein
with a field straße
. There are two Verein
objects where straße
has the value "Uhlandstraße".
What I want to achieve is that a search for "Uhl", "uhl", "nds", "straße" or "andstr" (you get the idea) returns those objects. Instead it does this:
>>> # With missing only 1 char at the end of the word, the search works.
>>> Verein.objects.filter(straße__search='Uhlandstraß')
<QuerySet [<Verein: 1>, <Verein: 2>]>
>>> # With missing more than 1 char at the and of the word, the search does not work.
>>> Verein.objects.filter(straße__search='Uhl')
<QuerySet []>
>>> Verein.objects.filter(straße__search='Uhlandstra')
<QuerySet []>
>>> # Same amount of chars as the working example, but from the end of the word, it does not work
>>> Verein.objects.filter(straße__search='hlandstraße')
<QuerySet []>
Any ideas what I need to change to get it working like explained?