Changed Search from SQL Like to RegEx
This commit is contained in:
@@ -114,12 +114,28 @@ class furatalogLib {
|
|||||||
$whereRequest .= " AND ";
|
$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 ?
|
" . ($section==1 ?
|
||||||
" OR species.name LIKE '%" . $tmpVal . "%' OR species.tag LIKE '%" . $tmpVal . "%') " :
|
" OR species.name REGEXP '%" . $tmpVal . "%' OR species.tag REGEXP '%" . $tmpVal . "%') " :
|
||||||
")") . "";
|
")") . "";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user