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"];
|
||||
}
|
||||
|
||||
$res = $database->get_col(
|
||||
"SELECT tag FROM tags WHERE tag LIKE :search AND count > 0 $limitSQL", $SQLarr);
|
||||
$res = $database->get_pairs("
|
||||
SELECT tag, count
|
||||
FROM tags
|
||||
WHERE tag LIKE :search
|
||||
AND count > 0
|
||||
ORDER BY count DESC
|
||||
$limitSQL", $SQLarr
|
||||
);
|
||||
|
||||
$page->set_mode("data");
|
||||
$page->set_type("application/json");
|
||||
|
@ -18,10 +18,10 @@ $(function(){
|
||||
dataType : 'json',
|
||||
type : 'GET',
|
||||
success : function (data) {
|
||||
response($.map(data, function (item) {
|
||||
response($.map(data, function (count, item) {
|
||||
item = (isNegative ? '-'+item : item);
|
||||
return {
|
||||
label : item,
|
||||
label : item + ' ('+count+')',
|
||||
value : item
|
||||
}
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user