Django Haystack + Xapian: Case-Insensitive Search Using AutoQuery

I am using Django with Haystack as a search engine and as a Xendian backend. How can I make sure that all searches are case insensitive? It would be much easier for the user if the search engine ignores the case and simply returns all the values ​​for a given search query.

My search index currently looks (simplified):

def ArticleIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.EdgeNgramField(document=True, use_template=True)
    name = indexes.CharField(model_attr='title')

    def get_model(self):
        return Article

And I use SearchViewand SearchFormincluded in django-haystack.

At the moment, the query for "Plat" gives 3 results, which is correct, the query for "plat" does not return results, which is also correct if the search is case-sensitive.

+4
source share

Source: https://habr.com/ru/post/1570376/


All Articles