sort autocomplete by score + show score
This commit is contained in:
parent
4bd9ee1c7f
commit
2546621c59
@ -20,8 +20,14 @@ class AutoComplete extends Extension {
|
|||||||
$SQLarr['limit'] = $_GET["limit"];
|
$SQLarr['limit'] = $_GET["limit"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = $database->get_col(
|
$res = $database->get_pairs("
|
||||||
"SELECT tag FROM tags WHERE tag LIKE :search AND count > 0 $limitSQL", $SQLarr);
|
SELECT tag, count
|
||||||
|
FROM tags
|
||||||
|
WHERE tag LIKE :search
|
||||||
|
AND count > 0
|
||||||
|
ORDER BY count DESC
|
||||||
|
$limitSQL", $SQLarr
|
||||||
|
);
|
||||||
|
|
||||||
$page->set_mode("data");
|
$page->set_mode("data");
|
||||||
$page->set_type("application/json");
|
$page->set_type("application/json");
|
||||||
|
@ -18,10 +18,10 @@ $(function(){
|
|||||||
dataType : 'json',
|
dataType : 'json',
|
||||||
type : 'GET',
|
type : 'GET',
|
||||||
success : function (data) {
|
success : function (data) {
|
||||||
response($.map(data, function (item) {
|
response($.map(data, function (count, item) {
|
||||||
item = (isNegative ? '-'+item : item);
|
item = (isNegative ? '-'+item : item);
|
||||||
return {
|
return {
|
||||||
label : item,
|
label : item + ' ('+count+')',
|
||||||
value : item
|
value : item
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user