我正在使用Django和Haystack作为搜索引擎和后端Xapian。如何才能使所有搜索都不区分大小写?对于用户来说,如果搜索引擎忽略大小写并且只返回给定搜索查询的所有值,那将会容易得多。
我的搜索索引目前看起来像这样(简化):
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
我正在使用django-haystack中包含的SearchView
和SearchForm
。
目前,对'Plat'的查询给出3个结果,这是正确的,'plat'的查询不会返回任何结果,如果搜索完成区分大小写,这也是正确的。