diff --git a/jssearch.js b/jssearch.js index 147af7d..2ad7efd 100644 --- a/jssearch.js +++ b/jssearch.js @@ -47,21 +47,21 @@ var jssearch = { queryWords: [], search: function(query) { - var words = $.jssearch.tokenizeString(query); + var words = jssearch.tokenizeString(query); var result = {}; - $.jssearch.queryWords = words.map(function(i) { return i.t; }); + jssearch.queryWords = words.map(function(i) { return i.t; }); // do not search when no words given if (!words.length) { return result; } -// result = $.jssearch.searchForWords(words); +// result = jssearch.searchForWords(words); // if ($.isEmptyObject(result)) { - words = $.jssearch.completeWords(words); - $.jssearch.queryWords = words.map(function(i) { return i.t; }); - result = $.jssearch.searchForWords(words); + words = jssearch.completeWords(words); + jssearch.queryWords = words.map(function(i) { return i.t; }); + result = jssearch.searchForWords(words); // } var res = []; @@ -75,13 +75,13 @@ var jssearch = { searchForWords: function(words) { var result = {}; words.forEach(function(word) { - if ($.jssearch.index[word.t]) { - $.jssearch.index[word.t].forEach(function(file) { + if (jssearch.index[word.t]) { + jssearch.index[word.t].forEach(function(file) { if (result[file.f]) { result[file.f].weight *= file.w * word.w; } else { result[file.f] = { - file: $.jssearch.files[file.f], + file: jssearch.files[file.f], weight: file.w * word.w }; } @@ -95,9 +95,9 @@ var jssearch = { var result = []; words.forEach(function(word) { - if (!$.jssearch.index[word.t] && word.t.length > 2) { + if (!jssearch.index[word.t] && word.t.length > 2) { // complete words that are not in the index - for(var w in $.jssearch.index) { + for(var w in jssearch.index) { if (w.substr(0, word.t.length) === word.t) { result.push({t: w, w: 1}); } diff --git a/lib/Indexer.php b/lib/Indexer.php index 254ca9a..7f53c31 100644 --- a/lib/Indexer.php +++ b/lib/Indexer.php @@ -77,9 +77,9 @@ public function exportJs() $tokenizeString = $this->getTokenizer()->tokenizeJs(); return <<