Haystack 方面区分大小写
用户模型有一个包含用户城市的字段。
在搜索网站上,我想显示城市中有多少用户注册,所以我使用方面:
result = search_query_set.facet('city')
result = result.facet_counts()
问题是,当用户使用不同的字母大小写添加城市时,即华沙和华沙,那么在调用方面之后,我将得到不同的属性华沙和为了华沙。是否可以强制 haystack 将华沙和华沙连接在一起?
User model has a field which contains user`s city.
On search site I want to show how many users in cities registered, so I use facets:
result = search_query_set.facet('city')
result = result.facet_counts()
The problem is that when users will add a city using different letter case, i. e. Warsaw and warsaw then after calling facet I will have in result different attribute for Warsaw and for warsaw. Is it possible to force haystack to join Warsaw and warsaw together?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不创建新的模型字段来保存该字段的所有大写版本
然后在这个字段上刻面
why don't you create new model field holds all uppercase version of that field
then facet over this field