ulalume3@11: /*
ulalume3@11: * searchtools.js_t
ulalume3@11: * ~~~~~~~~~~~~~~~~
ulalume3@11: *
ulalume3@11: * Sphinx JavaScript utilties for the full-text search.
ulalume3@11: *
ulalume3@11: * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
ulalume3@11: * :license: BSD, see LICENSE for details.
ulalume3@11: *
ulalume3@11: */
ulalume3@11:
ulalume3@11: /**
ulalume3@11: * helper function to return a node containing the
ulalume3@11: * search summary for a given text. keywords is a list
ulalume3@11: * of stemmed words, hlwords is the list of normal, unstemmed
ulalume3@11: * words. the first one is used to find the occurance, the
ulalume3@11: * latter for highlighting it.
ulalume3@11: */
ulalume3@11:
ulalume3@11: jQuery.makeSearchSummary = function(text, keywords, hlwords) {
ulalume3@11: var textLower = text.toLowerCase();
ulalume3@11: var start = 0;
ulalume3@11: $.each(keywords, function() {
ulalume3@11: var i = textLower.indexOf(this.toLowerCase());
ulalume3@11: if (i > -1)
ulalume3@11: start = i;
ulalume3@11: });
ulalume3@11: start = Math.max(start - 120, 0);
ulalume3@11: var excerpt = ((start > 0) ? '...' : '') +
ulalume3@11: $.trim(text.substr(start, 240)) +
ulalume3@11: ((start + 240 - text.length) ? '...' : '');
ulalume3@11: var rv = $('
').text(excerpt);
ulalume3@11: $.each(hlwords, function() {
ulalume3@11: rv = rv.highlightText(this, 'highlighted');
ulalume3@11: });
ulalume3@11: return rv;
ulalume3@11: }
ulalume3@11:
ulalume3@11:
ulalume3@11: /**
ulalume3@11: * Porter Stemmer
ulalume3@11: */
ulalume3@11: var Stemmer = function() {
ulalume3@11:
ulalume3@11: var step2list = {
ulalume3@11: ational: 'ate',
ulalume3@11: tional: 'tion',
ulalume3@11: enci: 'ence',
ulalume3@11: anci: 'ance',
ulalume3@11: izer: 'ize',
ulalume3@11: bli: 'ble',
ulalume3@11: alli: 'al',
ulalume3@11: entli: 'ent',
ulalume3@11: eli: 'e',
ulalume3@11: ousli: 'ous',
ulalume3@11: ization: 'ize',
ulalume3@11: ation: 'ate',
ulalume3@11: ator: 'ate',
ulalume3@11: alism: 'al',
ulalume3@11: iveness: 'ive',
ulalume3@11: fulness: 'ful',
ulalume3@11: ousness: 'ous',
ulalume3@11: aliti: 'al',
ulalume3@11: iviti: 'ive',
ulalume3@11: biliti: 'ble',
ulalume3@11: logi: 'log'
ulalume3@11: };
ulalume3@11:
ulalume3@11: var step3list = {
ulalume3@11: icate: 'ic',
ulalume3@11: ative: '',
ulalume3@11: alize: 'al',
ulalume3@11: iciti: 'ic',
ulalume3@11: ical: 'ic',
ulalume3@11: ful: '',
ulalume3@11: ness: ''
ulalume3@11: };
ulalume3@11:
ulalume3@11: var c = "[^aeiou]"; // consonant
ulalume3@11: var v = "[aeiouy]"; // vowel
ulalume3@11: var C = c + "[^aeiouy]*"; // consonant sequence
ulalume3@11: var V = v + "[aeiou]*"; // vowel sequence
ulalume3@11:
ulalume3@11: var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
ulalume3@11: var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
ulalume3@11: var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
ulalume3@11: var s_v = "^(" + C + ")?" + v; // vowel in stem
ulalume3@11:
ulalume3@11: this.stemWord = function (w) {
ulalume3@11: var stem;
ulalume3@11: var suffix;
ulalume3@11: var firstch;
ulalume3@11: var origword = w;
ulalume3@11:
ulalume3@11: if (w.length < 3)
ulalume3@11: return w;
ulalume3@11:
ulalume3@11: var re;
ulalume3@11: var re2;
ulalume3@11: var re3;
ulalume3@11: var re4;
ulalume3@11:
ulalume3@11: firstch = w.substr(0,1);
ulalume3@11: if (firstch == "y")
ulalume3@11: w = firstch.toUpperCase() + w.substr(1);
ulalume3@11:
ulalume3@11: // Step 1a
ulalume3@11: re = /^(.+?)(ss|i)es$/;
ulalume3@11: re2 = /^(.+?)([^s])s$/;
ulalume3@11:
ulalume3@11: if (re.test(w))
ulalume3@11: w = w.replace(re,"$1$2");
ulalume3@11: else if (re2.test(w))
ulalume3@11: w = w.replace(re2,"$1$2");
ulalume3@11:
ulalume3@11: // Step 1b
ulalume3@11: re = /^(.+?)eed$/;
ulalume3@11: re2 = /^(.+?)(ed|ing)$/;
ulalume3@11: if (re.test(w)) {
ulalume3@11: var fp = re.exec(w);
ulalume3@11: re = new RegExp(mgr0);
ulalume3@11: if (re.test(fp[1])) {
ulalume3@11: re = /.$/;
ulalume3@11: w = w.replace(re,"");
ulalume3@11: }
ulalume3@11: }
ulalume3@11: else if (re2.test(w)) {
ulalume3@11: var fp = re2.exec(w);
ulalume3@11: stem = fp[1];
ulalume3@11: re2 = new RegExp(s_v);
ulalume3@11: if (re2.test(stem)) {
ulalume3@11: w = stem;
ulalume3@11: re2 = /(at|bl|iz)$/;
ulalume3@11: re3 = new RegExp("([^aeiouylsz])\\1$");
ulalume3@11: re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
ulalume3@11: if (re2.test(w))
ulalume3@11: w = w + "e";
ulalume3@11: else if (re3.test(w)) {
ulalume3@11: re = /.$/;
ulalume3@11: w = w.replace(re,"");
ulalume3@11: }
ulalume3@11: else if (re4.test(w))
ulalume3@11: w = w + "e";
ulalume3@11: }
ulalume3@11: }
ulalume3@11:
ulalume3@11: // Step 1c
ulalume3@11: re = /^(.+?)y$/;
ulalume3@11: if (re.test(w)) {
ulalume3@11: var fp = re.exec(w);
ulalume3@11: stem = fp[1];
ulalume3@11: re = new RegExp(s_v);
ulalume3@11: if (re.test(stem))
ulalume3@11: w = stem + "i";
ulalume3@11: }
ulalume3@11:
ulalume3@11: // Step 2
ulalume3@11: re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
ulalume3@11: if (re.test(w)) {
ulalume3@11: var fp = re.exec(w);
ulalume3@11: stem = fp[1];
ulalume3@11: suffix = fp[2];
ulalume3@11: re = new RegExp(mgr0);
ulalume3@11: if (re.test(stem))
ulalume3@11: w = stem + step2list[suffix];
ulalume3@11: }
ulalume3@11:
ulalume3@11: // Step 3
ulalume3@11: re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
ulalume3@11: if (re.test(w)) {
ulalume3@11: var fp = re.exec(w);
ulalume3@11: stem = fp[1];
ulalume3@11: suffix = fp[2];
ulalume3@11: re = new RegExp(mgr0);
ulalume3@11: if (re.test(stem))
ulalume3@11: w = stem + step3list[suffix];
ulalume3@11: }
ulalume3@11:
ulalume3@11: // Step 4
ulalume3@11: re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
ulalume3@11: re2 = /^(.+?)(s|t)(ion)$/;
ulalume3@11: if (re.test(w)) {
ulalume3@11: var fp = re.exec(w);
ulalume3@11: stem = fp[1];
ulalume3@11: re = new RegExp(mgr1);
ulalume3@11: if (re.test(stem))
ulalume3@11: w = stem;
ulalume3@11: }
ulalume3@11: else if (re2.test(w)) {
ulalume3@11: var fp = re2.exec(w);
ulalume3@11: stem = fp[1] + fp[2];
ulalume3@11: re2 = new RegExp(mgr1);
ulalume3@11: if (re2.test(stem))
ulalume3@11: w = stem;
ulalume3@11: }
ulalume3@11:
ulalume3@11: // Step 5
ulalume3@11: re = /^(.+?)e$/;
ulalume3@11: if (re.test(w)) {
ulalume3@11: var fp = re.exec(w);
ulalume3@11: stem = fp[1];
ulalume3@11: re = new RegExp(mgr1);
ulalume3@11: re2 = new RegExp(meq1);
ulalume3@11: re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
ulalume3@11: if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
ulalume3@11: w = stem;
ulalume3@11: }
ulalume3@11: re = /ll$/;
ulalume3@11: re2 = new RegExp(mgr1);
ulalume3@11: if (re.test(w) && re2.test(w)) {
ulalume3@11: re = /.$/;
ulalume3@11: w = w.replace(re,"");
ulalume3@11: }
ulalume3@11:
ulalume3@11: // and turn initial Y back to y
ulalume3@11: if (firstch == "y")
ulalume3@11: w = firstch.toLowerCase() + w.substr(1);
ulalume3@11: return w;
ulalume3@11: }
ulalume3@11: }
ulalume3@11:
ulalume3@11:
ulalume3@11: /**
ulalume3@11: * Search Module
ulalume3@11: */
ulalume3@11: var Search = {
ulalume3@11:
ulalume3@11: _index : null,
ulalume3@11: _queued_query : null,
ulalume3@11: _pulse_status : -1,
ulalume3@11:
ulalume3@11: init : function() {
ulalume3@11: var params = $.getQueryParameters();
ulalume3@11: if (params.q) {
ulalume3@11: var query = params.q[0];
ulalume3@11: $('input[name="q"]')[0].value = query;
ulalume3@11: this.performSearch(query);
ulalume3@11: }
ulalume3@11: },
ulalume3@11:
ulalume3@11: loadIndex : function(url) {
ulalume3@11: $.ajax({type: "GET", url: url, data: null, success: null,
ulalume3@11: dataType: "script", cache: true});
ulalume3@11: },
ulalume3@11:
ulalume3@11: setIndex : function(index) {
ulalume3@11: var q;
ulalume3@11: this._index = index;
ulalume3@11: if ((q = this._queued_query) !== null) {
ulalume3@11: this._queued_query = null;
ulalume3@11: Search.query(q);
ulalume3@11: }
ulalume3@11: },
ulalume3@11:
ulalume3@11: hasIndex : function() {
ulalume3@11: return this._index !== null;
ulalume3@11: },
ulalume3@11:
ulalume3@11: deferQuery : function(query) {
ulalume3@11: this._queued_query = query;
ulalume3@11: },
ulalume3@11:
ulalume3@11: stopPulse : function() {
ulalume3@11: this._pulse_status = 0;
ulalume3@11: },
ulalume3@11:
ulalume3@11: startPulse : function() {
ulalume3@11: if (this._pulse_status >= 0)
ulalume3@11: return;
ulalume3@11: function pulse() {
ulalume3@11: Search._pulse_status = (Search._pulse_status + 1) % 4;
ulalume3@11: var dotString = '';
ulalume3@11: for (var i = 0; i < Search._pulse_status; i++)
ulalume3@11: dotString += '.';
ulalume3@11: Search.dots.text(dotString);
ulalume3@11: if (Search._pulse_status > -1)
ulalume3@11: window.setTimeout(pulse, 500);
ulalume3@11: };
ulalume3@11: pulse();
ulalume3@11: },
ulalume3@11:
ulalume3@11: /**
ulalume3@11: * perform a search for something
ulalume3@11: */
ulalume3@11: performSearch : function(query) {
ulalume3@11: // create the required interface elements
ulalume3@11: this.out = $('#search-results');
ulalume3@11: this.title = $('' + _('Searching') + '
').appendTo(this.out);
ulalume3@11: this.dots = $('').appendTo(this.title);
ulalume3@11: this.status = $('').appendTo(this.out);
ulalume3@11: this.output = $('').appendTo(this.out);
ulalume3@11:
ulalume3@11: $('#search-progress').text(_('Preparing search...'));
ulalume3@11: this.startPulse();
ulalume3@11:
ulalume3@11: // index already loaded, the browser was quick!
ulalume3@11: if (this.hasIndex())
ulalume3@11: this.query(query);
ulalume3@11: else
ulalume3@11: this.deferQuery(query);
ulalume3@11: },
ulalume3@11:
ulalume3@11: query : function(query) {
ulalume3@11: var stopwords = ["and","then","into","it","as","are","in","if","for","no","there","their","was","is","be","to","that","but","they","not","such","with","by","a","on","these","of","will","this","near","the","or","at"];
ulalume3@11:
ulalume3@11: // Stem the searchterms and add them to the correct list
ulalume3@11: var stemmer = new Stemmer();
ulalume3@11: var searchterms = [];
ulalume3@11: var excluded = [];
ulalume3@11: var hlterms = [];
ulalume3@11: var tmp = query.split(/\s+/);
ulalume3@11: var objectterms = [];
ulalume3@11: for (var i = 0; i < tmp.length; i++) {
ulalume3@11: if (tmp[i] != "") {
ulalume3@11: objectterms.push(tmp[i].toLowerCase());
ulalume3@11: }
ulalume3@11:
ulalume3@11: if ($u.indexOf(stopwords, tmp[i]) != -1 || tmp[i].match(/^\d+$/) ||
ulalume3@11: tmp[i] == "") {
ulalume3@11: // skip this "word"
ulalume3@11: continue;
ulalume3@11: }
ulalume3@11: // stem the word
ulalume3@11: var word = stemmer.stemWord(tmp[i]).toLowerCase();
ulalume3@11: // select the correct list
ulalume3@11: if (word[0] == '-') {
ulalume3@11: var toAppend = excluded;
ulalume3@11: word = word.substr(1);
ulalume3@11: }
ulalume3@11: else {
ulalume3@11: var toAppend = searchterms;
ulalume3@11: hlterms.push(tmp[i].toLowerCase());
ulalume3@11: }
ulalume3@11: // only add if not already in the list
ulalume3@11: if (!$.contains(toAppend, word))
ulalume3@11: toAppend.push(word);
ulalume3@11: };
ulalume3@11: var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" "));
ulalume3@11:
ulalume3@11: // console.debug('SEARCH: searching for:');
ulalume3@11: // console.info('required: ', searchterms);
ulalume3@11: // console.info('excluded: ', excluded);
ulalume3@11:
ulalume3@11: // prepare search
ulalume3@11: var filenames = this._index.filenames;
ulalume3@11: var titles = this._index.titles;
ulalume3@11: var terms = this._index.terms;
ulalume3@11: var fileMap = {};
ulalume3@11: var files = null;
ulalume3@11: // different result priorities
ulalume3@11: var importantResults = [];
ulalume3@11: var objectResults = [];
ulalume3@11: var regularResults = [];
ulalume3@11: var unimportantResults = [];
ulalume3@11: $('#search-progress').empty();
ulalume3@11:
ulalume3@11: // lookup as object
ulalume3@11: for (var i = 0; i < objectterms.length; i++) {
ulalume3@11: var others = [].concat(objectterms.slice(0,i),
ulalume3@11: objectterms.slice(i+1, objectterms.length))
ulalume3@11: var results = this.performObjectSearch(objectterms[i], others);
ulalume3@11: // Assume first word is most likely to be the object,
ulalume3@11: // other words more likely to be in description.
ulalume3@11: // Therefore put matches for earlier words first.
ulalume3@11: // (Results are eventually used in reverse order).
ulalume3@11: objectResults = results[0].concat(objectResults);
ulalume3@11: importantResults = results[1].concat(importantResults);
ulalume3@11: unimportantResults = results[2].concat(unimportantResults);
ulalume3@11: }
ulalume3@11:
ulalume3@11: // perform the search on the required terms
ulalume3@11: for (var i = 0; i < searchterms.length; i++) {
ulalume3@11: var word = searchterms[i];
ulalume3@11: // no match but word was a required one
ulalume3@11: if ((files = terms[word]) == null)
ulalume3@11: break;
ulalume3@11: if (files.length == undefined) {
ulalume3@11: files = [files];
ulalume3@11: }
ulalume3@11: // create the mapping
ulalume3@11: for (var j = 0; j < files.length; j++) {
ulalume3@11: var file = files[j];
ulalume3@11: if (file in fileMap)
ulalume3@11: fileMap[file].push(word);
ulalume3@11: else
ulalume3@11: fileMap[file] = [word];
ulalume3@11: }
ulalume3@11: }
ulalume3@11:
ulalume3@11: // now check if the files don't contain excluded terms
ulalume3@11: for (var file in fileMap) {
ulalume3@11: var valid = true;
ulalume3@11:
ulalume3@11: // check if all requirements are matched
ulalume3@11: if (fileMap[file].length != searchterms.length)
ulalume3@11: continue;
ulalume3@11:
ulalume3@11: // ensure that none of the excluded terms is in the
ulalume3@11: // search result.
ulalume3@11: for (var i = 0; i < excluded.length; i++) {
ulalume3@11: if (terms[excluded[i]] == file ||
ulalume3@11: $.contains(terms[excluded[i]] || [], file)) {
ulalume3@11: valid = false;
ulalume3@11: break;
ulalume3@11: }
ulalume3@11: }
ulalume3@11:
ulalume3@11: // if we have still a valid result we can add it
ulalume3@11: // to the result list
ulalume3@11: if (valid)
ulalume3@11: regularResults.push([filenames[file], titles[file], '', null]);
ulalume3@11: }
ulalume3@11:
ulalume3@11: // delete unused variables in order to not waste
ulalume3@11: // memory until list is retrieved completely
ulalume3@11: delete filenames, titles, terms;
ulalume3@11:
ulalume3@11: // now sort the regular results descending by title
ulalume3@11: regularResults.sort(function(a, b) {
ulalume3@11: var left = a[1].toLowerCase();
ulalume3@11: var right = b[1].toLowerCase();
ulalume3@11: return (left > right) ? -1 : ((left < right) ? 1 : 0);
ulalume3@11: });
ulalume3@11:
ulalume3@11: // combine all results
ulalume3@11: var results = unimportantResults.concat(regularResults)
ulalume3@11: .concat(objectResults).concat(importantResults);
ulalume3@11:
ulalume3@11: // print the results
ulalume3@11: var resultCount = results.length;
ulalume3@11: function displayNextItem() {
ulalume3@11: // results left, load the summary and display it
ulalume3@11: if (results.length) {
ulalume3@11: var item = results.pop();
ulalume3@11: var listItem = $('');
ulalume3@11: if (DOCUMENTATION_OPTIONS.FILE_SUFFIX == '') {
ulalume3@11: // dirhtml builder
ulalume3@11: var dirname = item[0] + '/';
ulalume3@11: if (dirname.match(/\/index\/$/)) {
ulalume3@11: dirname = dirname.substring(0, dirname.length-6);
ulalume3@11: } else if (dirname == 'index/') {
ulalume3@11: dirname = '';
ulalume3@11: }
ulalume3@11: listItem.append($('').attr('href',
ulalume3@11: DOCUMENTATION_OPTIONS.URL_ROOT + dirname +
ulalume3@11: highlightstring + item[2]).html(item[1]));
ulalume3@11: } else {
ulalume3@11: // normal html builders
ulalume3@11: listItem.append($('').attr('href',
ulalume3@11: item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
ulalume3@11: highlightstring + item[2]).html(item[1]));
ulalume3@11: }
ulalume3@11: if (item[3]) {
ulalume3@11: listItem.append($(' (' + item[3] + ')'));
ulalume3@11: Search.output.append(listItem);
ulalume3@11: listItem.slideDown(5, function() {
ulalume3@11: displayNextItem();
ulalume3@11: });
ulalume3@11: } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
ulalume3@11: $.get(DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' +
ulalume3@11: item[0] + '.txt', function(data) {
ulalume3@11: if (data != '') {
ulalume3@11: listItem.append($.makeSearchSummary(data, searchterms, hlterms));
ulalume3@11: Search.output.append(listItem);
ulalume3@11: }
ulalume3@11: listItem.slideDown(5, function() {
ulalume3@11: displayNextItem();
ulalume3@11: });
ulalume3@11: }, "text");
ulalume3@11: } else {
ulalume3@11: // no source available, just display title
ulalume3@11: Search.output.append(listItem);
ulalume3@11: listItem.slideDown(5, function() {
ulalume3@11: displayNextItem();
ulalume3@11: });
ulalume3@11: }
ulalume3@11: }
ulalume3@11: // search finished, update title and status message
ulalume3@11: else {
ulalume3@11: Search.stopPulse();
ulalume3@11: Search.title.text(_('Search Results'));
ulalume3@11: if (!resultCount)
ulalume3@11: Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
ulalume3@11: else
ulalume3@11: Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
ulalume3@11: Search.status.fadeIn(500);
ulalume3@11: }
ulalume3@11: }
ulalume3@11: displayNextItem();
ulalume3@11: },
ulalume3@11:
ulalume3@11: performObjectSearch : function(object, otherterms) {
ulalume3@11: var filenames = this._index.filenames;
ulalume3@11: var objects = this._index.objects;
ulalume3@11: var objnames = this._index.objnames;
ulalume3@11: var titles = this._index.titles;
ulalume3@11:
ulalume3@11: var importantResults = [];
ulalume3@11: var objectResults = [];
ulalume3@11: var unimportantResults = [];
ulalume3@11:
ulalume3@11: for (var prefix in objects) {
ulalume3@11: for (var name in objects[prefix]) {
ulalume3@11: var fullname = (prefix ? prefix + '.' : '') + name;
ulalume3@11: if (fullname.toLowerCase().indexOf(object) > -1) {
ulalume3@11: var match = objects[prefix][name];
ulalume3@11: var objname = objnames[match[1]][2];
ulalume3@11: var title = titles[match[0]];
ulalume3@11: // If more than one term searched for, we require other words to be
ulalume3@11: // found in the name/title/description
ulalume3@11: if (otherterms.length > 0) {
ulalume3@11: var haystack = (prefix + ' ' + name + ' ' +
ulalume3@11: objname + ' ' + title).toLowerCase();
ulalume3@11: var allfound = true;
ulalume3@11: for (var i = 0; i < otherterms.length; i++) {
ulalume3@11: if (haystack.indexOf(otherterms[i]) == -1) {
ulalume3@11: allfound = false;
ulalume3@11: break;
ulalume3@11: }
ulalume3@11: }
ulalume3@11: if (!allfound) {
ulalume3@11: continue;
ulalume3@11: }
ulalume3@11: }
ulalume3@11: var descr = objname + _(', in ') + title;
ulalume3@11: anchor = match[3];
ulalume3@11: if (anchor == '')
ulalume3@11: anchor = fullname;
ulalume3@11: else if (anchor == '-')
ulalume3@11: anchor = objnames[match[1]][1] + '-' + fullname;
ulalume3@11: result = [filenames[match[0]], fullname, '#'+anchor, descr];
ulalume3@11: switch (match[2]) {
ulalume3@11: case 1: objectResults.push(result); break;
ulalume3@11: case 0: importantResults.push(result); break;
ulalume3@11: case 2: unimportantResults.push(result); break;
ulalume3@11: }
ulalume3@11: }
ulalume3@11: }
ulalume3@11: }
ulalume3@11:
ulalume3@11: // sort results descending
ulalume3@11: objectResults.sort(function(a, b) {
ulalume3@11: return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
ulalume3@11: });
ulalume3@11:
ulalume3@11: importantResults.sort(function(a, b) {
ulalume3@11: return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
ulalume3@11: });
ulalume3@11:
ulalume3@11: unimportantResults.sort(function(a, b) {
ulalume3@11: return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
ulalume3@11: });
ulalume3@11:
ulalume3@11: return [importantResults, objectResults, unimportantResults]
ulalume3@11: }
ulalume3@11: }
ulalume3@11:
ulalume3@11: $(document).ready(function() {
ulalume3@11: Search.init();
ulalume3@11: });