我正在对我的博客进行简单的搜索。我使用亚美尼亚语,当我搜索时,这些字母总是有意义的。这是我的代码的一部分。先感谢您。
search_query = get.get('search')
query_list = search_query.split()
posts = post.objects.filter(
reduce(operator.and_,
(Q(title__icontains=q) for q in query_list))|
reduce(operator.and_,
(Q(content__icontains=q) for q in query_list)),
)
这通常只是 SQLite 的问题,文档链接上详细描述了问题,还有一个返回原始 SQLite 站点描述的链接
来自 Django图标包含 https://docs.djangoproject.com/en/1.11/ref/models/querysets/#icontains文档
SQLite 用户
使用 SQLite 后端和非 ASCII 字符串时,请记住
数据库注释关于字符串比较 https://docs.djangoproject.com/en/dev/ref/databases/#substring-matching-and-case-sensitivity.
关于以下问题的 SQLite 文档 https://www.sqlite.org/faq.html#q18
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)