Mercurial > epgrec.yaz
changeset 130:290a05fd7331
mod: 半角英数で検索しても全角英数がヒットするように変更
author | Sushi-k <epgrec@park.mda.or.jp> |
---|---|
date | Thu, 18 Mar 2010 17:50:01 +0900 |
parents | 1e93ea03ebd9 |
children | 2646140c5ba7 |
files | Keyword.class.php |
diffstat | 1 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/Keyword.class.php Wed Mar 17 20:39:36 2010 +0900 +++ b/Keyword.class.php Thu Mar 18 17:50:01 2010 +0900 @@ -36,7 +36,23 @@ $options .= " AND CONCAT(title,description) REGEXP '".mysql_real_escape_string($keyword)."'"; } else { - $options .= " AND CONCAT(title,description) like '%".mysql_real_escape_string($keyword)."%'"; + // 茹茹 + // 翫絲上 + $f_zennum = preg_match('/[0-9]/u', $keyword ); + $f_zenal = preg_match('/[a-zA-Z]/u', $keyword ); + + $options .= " AND ( CONCAT(title,' ',description) like '%".mysql_real_escape_string($keyword)."%'"; + + if( $f_zennum ) { + $options .= " OR CONCAT(title,' ',description) like '%".mysql_real_escape_string(mb_convert_kana( $keyword, 'KVN' ))."%'"; + } + if( $f_zenal ) { + $options .= " OR CONCAT(title,' ',description) like '%".mysql_real_escape_string(mb_convert_kana( $keyword, 'KVR' ))."%'"; + } + if( $f_zenal && $f_zennum ) { + $options .= " OR CONCAT(title,' ',description) like '%".mysql_real_escape_string(mb_convert_kana( $keyword, 'KVRN' ))."%'"; + } + $options .= ") "; } } @@ -163,4 +179,4 @@ parent::__destruct(); } } -?> \ No newline at end of file +?>