Changed Search from SQL Like to RegEx

This commit is contained in:
2025-06-10 13:38:28 +02:00
parent 60cae20fd8
commit 3837ebaa91
+20 -4
View File
@@ -114,12 +114,28 @@ class furatalogLib {
$whereRequest .= " AND ";
}
$tmpVal = implode('%', str_split($tmpVal));
//$tmpVal = implode('%', str_split($tmpVal));
$newtmpVal = "";
$whereRequest .= "(content.name LIKE '%" . $tmpVal . "%' OR
creator.name LIKE '%" . $tmpVal . "%'
$maxStringPos = strlen($tmpVal);
$currentStringPos = 1;
foreach (str_split($tmpVal) as $key2 => $value2) {
if ($currentStringPos < $maxStringPos) {
$newtmpVal .= $value2 . "[^" . $value2 . "]{0,2}";
} else {
$newtmpVal .= $value2;
}
$currentStringPos++;
}
$tmpVal = $newtmpVal;
$whereRequest .= "(content.name REGEXP '%" . $tmpVal . "%' OR
creator.name REGEXP '%" . $tmpVal . "%'
" . ($section==1 ?
" OR species.name LIKE '%" . $tmpVal . "%' OR species.tag LIKE '%" . $tmpVal . "%') " :
" OR species.name REGEXP '%" . $tmpVal . "%' OR species.tag REGEXP '%" . $tmpVal . "%') " :
")") . "";
}
} else {