mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-28 20:29:58 +03:00
fixes #1118 competition between regexp models
This commit is contained in:
parent
a02edff655
commit
d0497f035c
1 changed files with 14 additions and 2 deletions
|
@ -933,8 +933,20 @@ function qsearch_get_text_token_search_sql($token, $fields)
|
||||||
|
|
||||||
if (!$use_ft)
|
if (!$use_ft)
|
||||||
{// odd term or too short for full text search; fallback to regex but unfortunately this is diacritic/accent sensitive
|
{// odd term or too short for full text search; fallback to regex but unfortunately this is diacritic/accent sensitive
|
||||||
$pre = ($token->modifier & QST_WILDCARD_BEGIN) ? '' : '[[:<:]]';
|
if (!isset($page['use_regexp_ICU']))
|
||||||
$post = ($token->modifier & QST_WILDCARD_END) ? '' : '[[:>:]]';
|
{
|
||||||
|
// Prior to MySQL 8.0.4, MySQL used the Henry Spencer regular expression library to support
|
||||||
|
// regular expression operations, rather than International Components for Unicode (ICU)
|
||||||
|
$page['use_regexp_ICU'] = false;
|
||||||
|
$db_version = pwg_get_db_version();
|
||||||
|
if (!preg_match('/mariadb/i', $db_version) and version_compare($db_version, '8.0.4', '>'))
|
||||||
|
{
|
||||||
|
$page['use_regexp_ICU'] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$pre = ($token->modifier & QST_WILDCARD_BEGIN) ? '' : ($page['use_regexp_ICU'] ? '\\\\b' : '[[:<:]]');
|
||||||
|
$post = ($token->modifier & QST_WILDCARD_END) ? '' : ($page['use_regexp_ICU'] ? '\\\\b' : '[[:>:]]');
|
||||||
foreach( $fields as $field)
|
foreach( $fields as $field)
|
||||||
$clauses[] = $field.' REGEXP \''.$pre.addslashes(preg_quote($variant)).$post.'\'';
|
$clauses[] = $field.' REGEXP \''.$pre.addslashes(preg_quote($variant)).$post.'\'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue