Browse Source

lunr.js update to 0.2.2

pull/160/head
Simon Waldherr 12 years ago
parent
commit
e0f1088c44
  1. 23
      dist/ratchet.js
  2. 22
      lib/js/lunr.js
  3. 2
      submodules/lunrjs

23
dist/ratchet.js vendored

@ -765,7 +765,7 @@
}();
/* ----------------------------------
* lunr v0.2.1
* lunr v0.2.2
* http://lunrjs.com - A bit like Solr, but much smaller and not as bright
* Copyright (C) 2013 Oliver Nightingale
* Licensed under The MIT License
@ -782,7 +782,7 @@ var lunr = function (config) {
return idx
}
lunr.version = "0.2.1"
lunr.version = "0.2.2"
if (typeof module !== 'undefined') {
module.exports = lunr
@ -960,19 +960,19 @@ lunr.SortedSet.prototype.intersect = function (otherSet) {
if (a[i] === b[j]) {
intersectSet.add(a[i]);
i++;
i++;
j++;
continue
continue;
}
if (a[i] < b[j]) {
i++
continue
i++;
continue;
}
if (a[i] > b[j]) {
j++
continue
j++;
continue;
}
};
@ -1102,10 +1102,15 @@ lunr.Index.prototype.search = function (query) {
var set = this.tokenStore.expand(token).reduce(function (memo, key) {
var pos = self.corpusTokens.indexOf(key),
idf = self.idf(key),
exactMatchBoost = (key === token ? 10 : 1),
set = new lunr.SortedSet
if (pos > -1) queryArr[pos] = tf * idf
// calculate the query tf-idf score for this token
// applying an exactMatchBoost to ensure these rank
// higher than expanded terms
if (pos > -1) queryArr[pos] = tf * idf * exactMatchBoost
// add all the documents that have this key into a set
Object.keys(self.tokenStore.get(key)).forEach(function (ref) { set.add(ref) })
return memo.union(set)

22
lib/js/lunr.js

@ -1,5 +1,5 @@
/* ----------------------------------
* lunr v0.2.1
* lunr v0.2.2
* http://lunrjs.com - A bit like Solr, but much smaller and not as bright
* Copyright (C) 2013 Oliver Nightingale
* Licensed under The MIT License
@ -16,7 +16,7 @@ var lunr = function (config) {
return idx
}
lunr.version = "0.2.1"
lunr.version = "0.2.2"
if (typeof module !== 'undefined') {
module.exports = lunr
@ -370,9 +370,8 @@ lunr.SortedSet.prototype.intersect = function (otherSet) {
if (i > a_len - 1 || j > b_len - 1) break
if (a[i] === b[j]) {
intersectSet.add(a[i]);
i++;
j++;
intersectSet.add(a[i])
i++, j++
continue
}
@ -417,11 +416,9 @@ lunr.SortedSet.prototype.union = function (otherSet) {
var longSet, shortSet, unionSet
if (this.length >= otherSet.length) {
longSet = this;
shortSet = otherSet;
longSet = this, shortSet = otherSet
} else {
longSet = otherSet;
shortSet = this;
longSet = otherSet, shortSet = this
}
unionSet = longSet.clone()
@ -633,10 +630,15 @@ lunr.Index.prototype.search = function (query) {
var set = this.tokenStore.expand(token).reduce(function (memo, key) {
var pos = self.corpusTokens.indexOf(key),
idf = self.idf(key),
exactMatchBoost = (key === token ? 10 : 1),
set = new lunr.SortedSet
if (pos > -1) queryArr[pos] = tf * idf
// calculate the query tf-idf score for this token
// applying an exactMatchBoost to ensure these rank
// higher than expanded terms
if (pos > -1) queryArr[pos] = tf * idf * exactMatchBoost
// add all the documents that have this key into a set
Object.keys(self.tokenStore.get(key)).forEach(function (ref) { set.add(ref) })
return memo.union(set)

2
submodules/lunrjs

@ -1 +1 @@
Subproject commit 5bcfe579a8fe72dab7fbb1f179e9ca0d5ea6df6d
Subproject commit 269e4ad5b66d8481f9fce67ec485f1f4a09ffc4e
Loading…
Cancel
Save