我无法根据需要使PostgreSQL 全文搜索功能正常工作。
我有一个Verein
带有字段的模型straße
。有两个Verein
对象straße
的值为"Uhlandstraße"。
我想要实现的是搜索“Uhl”、“uhl”、“nds”、“straße”或“andstr”(你明白了)会返回这些对象。相反,它这样做:
>>> # 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 []>
有什么想法我需要改变才能让它像解释的那样工作吗?