Changed autocomplete to escape _ and %, lowercase the tags, and also query for tag names that are preceded by categories to address #630
This commit is contained in:
parent
aa9ce52f47
commit
8d567e9553
@ -38,7 +38,9 @@ class AutoComplete extends Extension
|
|||||||
//$limit = 0;
|
//$limit = 0;
|
||||||
$cache_key = "autocomplete-$s";
|
$cache_key = "autocomplete-$s";
|
||||||
$limitSQL = "";
|
$limitSQL = "";
|
||||||
$SQLarr = ["search"=>"$s%"];
|
$s = str_replace('_','\_', $s);
|
||||||
|
$s = str_replace('%','\%', $s);
|
||||||
|
$SQLarr = ["search"=>"$s%", "cat_search"=>"%:$s%"];
|
||||||
if (isset($_GET["limit"]) && $_GET["limit"] !== 0) {
|
if (isset($_GET["limit"]) && $_GET["limit"] !== 0) {
|
||||||
$limitSQL = "LIMIT :limit";
|
$limitSQL = "LIMIT :limit";
|
||||||
$SQLarr['limit'] = $_GET["limit"];
|
$SQLarr['limit'] = $_GET["limit"];
|
||||||
@ -51,7 +53,8 @@ class AutoComplete extends Extension
|
|||||||
$database->scoreql_to_sql("
|
$database->scoreql_to_sql("
|
||||||
SELECT tag, count
|
SELECT tag, count
|
||||||
FROM tags
|
FROM tags
|
||||||
WHERE SCORE_STRNORM(tag) LIKE SCORE_STRNORM(:search)
|
WHERE SCORE_STRNORM(tag) LIKE SCORE_STRNORM(:search)
|
||||||
|
OR SCORE_STRNORM(tag) LIKE SCORE_STRNORM(:cat_search)
|
||||||
AND count > 0
|
AND count > 0
|
||||||
ORDER BY count DESC
|
ORDER BY count DESC
|
||||||
$limitSQL"),
|
$limitSQL"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user