简体   繁体   English

searchlogic中不区分大小写

[英]case insensitive in searchlogic

Searchlogic可以不区分大小写地进行搜索吗?

according to searchlogic Read Me 根据searchlogic 自述

you can use 您可以使用

User.username_like("bjohnson")

and like is case inesnsitive . 就像case inesnsitive

Depends on your database configuration. 取决于您的数据库配置。 For instance, postgres is case-sensitive by default and 例如,默认情况下,postgres区分大小写,

User.username_like("bjohnson")

would not find Bjohnson. 找不到约翰逊。

sqlite is case-insensitive by default and would find Bjohnson, however. sqlite默认情况下不区分大小写,但是可以找到Bjohnson。

Later versions of binarylogic's searchlogic has postgres-specific code that uses ILIKE to perform case-insensitive searches. Binarylogic的searchlogic的更高版本具有特定于Postgres的代码,该代码使用ILIKE执行不区分大小写的搜索。

Any custom named scopes that you create will of course need to consider your db platform when case-sensitivity is a concern. 当考虑区分大小写时,您创建的任何自定义命名作用域当然都需要考虑您的数据库平台。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM