$(function() {
    // setup search suggestions
    // @see https://goodies.pixabay.com/jquery/auto-complete/demo.html
    var field = $('#search input'),
        url = _g.suggest_url;

    field.autoComplete({
        source: function(term, response){
            $.getJSON(url, { q: term.toLowerCase() }, function(data) {
                response(data[1].slice(0, 10));
            });
        },
        onSelect: function() {
            $('#search form').submit();
        }
    });

    // auto-select cite box
    $('input.cite').on('click', function(ev) {
        $(this).select()
    });
});
@@ -175,17 +175,262 @@
 gest_url
-;
+,%0A        xhr;%0A%0A    function highlight(item, query) %7B%0A        query = query.replace(/%5B-%5C/%5C%5C%5E$*+?.()%7C%5B%5C%5D%7B%7D%5D/g, '%5C%5C$&');%0A        var re = new RegExp(%22(%22 + query.split(' ').join('%7C') + %22)%22, %22gi%22);%0A%0A        return item.replace(re, %22%3Cb%3E$1%3C/b%3E%22);%0A    %7D
 %0A%0A    fi
@@ -501,16 +501,66 @@
         
+ try %7B xhr.abort(); %7D catch(e)%7B%7D%0A            xhr =
  $.getJS
@@ -631,37 +631,173 @@
     
-response(data%5B1%5D.slice(0, 10)
+var suggestions = %5B%5D;%0A%0A                // keyword suggestions%0A                data%5B1%5D.slice(0, 10).forEach(function(item) %7B%0A                    suggestions.push(item
 );%0A 
@@ -811,54 +811,999 @@
     
+ 
+   
 %7D);%0A
-        %7D,%0A        onSelect: function() %7B%0A
+%0A                // publications suggest%0A                data%5B2%5D.forEach(function(item) %7B%0A                    suggestions.push('%3Cdiv class=%22autocomplete-suggestion%22 data-url=%22' + item.url + '%22%3E' +%0A                        highlight(item.name, data%5B0%5D) +%0A                        '%3Csmall%3E' + item.info + '%3C/small%3E%3C/div%3E');%0A                %7D);%0A%0A                console.log(suggestions);%0A                response(suggestions);%0A            %7D);%0A        %7D,%0A        renderItem: function (item, search)%7B%0A            // item is already rendered by source()%0A            if (item%5B0%5D === '%3C') %7B%0A                return item;%0A            %7D%0A%0A            // plain text suggestion%0A            return '%3Cdiv class=%22autocomplete-suggestion%22 data-val=%22' + item + '%22%3E' + highlight(item, search) + '%3C/div%3E';%0A        %7D,%0A        onSelect: function(event, term, item) %7B%0A            var url = item.data('url');%0A            if (url) %7B%0A                document.location = url;%0A            %7D%0A            else %7B%0A    
     
@@ -1838,16 +1838,30 @@
 bmit();%0A
+            %7D%0A
         

handle new suggestions format