Haystack 方面区分大小写

发布于 2024-12-22 13:55:32 字数 254 浏览 3 评论 0原文

用户模型有一个包含用户城市的字段。

在搜索网站上,我想显示城市中有多少用户注册,所以我使用方面:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情深如许 2024-12-29 13:55:32

为什么不创建新的模型字段来保存该字段的所有大写版本
然后在这个字段上刻面

why don't you create new model field holds all uppercase version of that field
then facet over this field

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文