Fixed tag autocompletion
It yielded too many results in some cases.
This commit is contained in:
parent
e346a8e57c
commit
24f5024db3
2 changed files with 7 additions and 6 deletions
|
@ -158,10 +158,11 @@ $(function()
|
|||
source: function(request, response)
|
||||
{
|
||||
var term = extractLast(request.term);
|
||||
$.get(searchInput.attr('data-autocomplete-url') + '?json', {filter: term}, function(data)
|
||||
{
|
||||
response($.map(data.tags, function(tag) { return { label: tag, value: tag }; }));
|
||||
});
|
||||
if (term != '')
|
||||
$.get(searchInput.attr('data-autocomplete-url') + '?json', {filter: term}, function(data)
|
||||
{
|
||||
response($.map(data.tags, function(tag) { return { label: tag, value: tag }; }));
|
||||
});
|
||||
},
|
||||
focus: function()
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ class TagController
|
|||
$dbQuery->from('tag');
|
||||
$dbQuery->innerJoin('post_tag');
|
||||
$dbQuery->on('tag.id = post_tag.tag_id');
|
||||
if ($suppliedFilter)
|
||||
if ($suppliedFilter !== null)
|
||||
{
|
||||
if (strlen($suppliedFilter) >= 3)
|
||||
$suppliedFilter = '%' . $suppliedFilter;
|
||||
|
@ -26,7 +26,7 @@ class TagController
|
|||
}
|
||||
$dbQuery->groupBy('tag.id');
|
||||
$dbQuery->orderBy('LOWER(tag.name)')->asc();
|
||||
if ($suppliedFilter)
|
||||
if ($suppliedFilter !== null)
|
||||
$dbQuery->limit(15);
|
||||
$rows = $dbQuery->get();
|
||||
$tags = R::convertToBeans('tag', $rows);
|
||||
|
|
Loading…
Reference in a new issue