Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.2.0-rc.1 使用Pgsql 搜索区分了大小写 #1187

Closed
kairyou opened this issue Sep 22, 2021 · 1 comment
Closed

v1.2.0-rc.1 使用Pgsql 搜索区分了大小写 #1187

kairyou opened this issue Sep 22, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@kairyou
Copy link

kairyou commented Sep 22, 2021

mysql 搜索是不区分大小写的, 切到postgres发现搜索区分了大小写.

  • 数据库版本:psql (PostgreSQL) 13.4
  • PHP 版本:PHP 7.4.19
  • Typecho 版本:v1.2.0-rc.1

var/Widget/Archive.php的搜索 和 admin 里的搜索, 是不是调整下Pgsql的判断, 比如

$adapterName = $this->db->getAdapterName();
if (strpos($adapterName, 'Pgsql')) {
  $select->where('table.contents.title ~~* ? OR table.contents.text ~~* ?', $searchQuery, $searchQuery)
    ->where('table.contents.type = ?', 'post');
} else {
  $select->where('table.contents.title LIKE ? OR table.contents.text LIKE ?', $searchQuery, $searchQuery)
    ->where('table.contents.type = ?', 'post');
}
@joyqi
Copy link
Member

joyqi commented Sep 23, 2021

确实有这个问题,不过这么改有点丑,我得想一个更好的解决方法

@joyqi joyqi added the bug Something isn't working label Sep 23, 2021
@joyqi joyqi closed this as completed in c66b6e2 Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants