Comparing version 2.0.0-alpha.4 to 2.0.0-alpha.5
@@ -30,5 +30,17 @@ /*! | ||
this.edges = {} | ||
this.id = lunr.TokenSet._nextId | ||
lunr.TokenSet._nextId += 1 | ||
} | ||
/** | ||
* Keeps track of the next, auto increment, identifier to assign | ||
* to a new tokenSet. | ||
* | ||
* TokenSets require a unique identifier to be correctly minimised. | ||
* | ||
* @private | ||
*/ | ||
lunr.TokenSet._nextId = 1 | ||
/** | ||
* Creates a TokenSet instance from the given sorted array of words. | ||
@@ -331,3 +343,3 @@ * | ||
var str = this.final ? '1' : '0', | ||
labels = Object.keys(this.edges), | ||
labels = Object.keys(this.edges).sort(), | ||
len = labels.length | ||
@@ -339,3 +351,3 @@ | ||
str = str + label + node.toString() | ||
str = str + label + node.id | ||
} | ||
@@ -342,0 +354,0 @@ |
{ | ||
"name": "lunr", | ||
"description": "Simple full-text search in your browser.", | ||
"version": "2.0.0-alpha.4", | ||
"version": "2.0.0-alpha.5", | ||
"author": "Oliver Nightingale", | ||
@@ -6,0 +6,0 @@ "keywords": ["search"], |
@@ -29,13 +29,16 @@ suite('lunr.TokenSet', function () { | ||
test('includes child node', function () { | ||
var a = new lunr.TokenSet, | ||
b = new lunr.TokenSet, | ||
c = new lunr.TokenSet | ||
test('includes edge id', function () { | ||
var childA = new lunr.TokenSet, | ||
childB = new lunr.TokenSet, | ||
parentA = new lunr.TokenSet, | ||
parentB = new lunr.TokenSet | ||
parentC = new lunr.TokenSet | ||
a.edges['x'] = 1 | ||
b.edges['x'] = 2 | ||
c.edges['x'] = 1 | ||
parentA.edges['a'] = childA | ||
parentB.edges['a'] = childB | ||
parentC.edges['a'] = childB | ||
assert.equal(a.toString(), c.toString()) | ||
assert.notEqual(a.toString(), b.toString()) | ||
assert.equal(parentB.toString(), parentC.toString()) | ||
assert.notEqual(parentA.toString(), parentC.toString()) | ||
assert.notEqual(parentA.toString(), parentB.toString()) | ||
}) | ||
@@ -46,5 +49,6 @@ }) | ||
test('without wildcard', function () { | ||
lunr.TokenSet._nextId = 1 | ||
var x = lunr.TokenSet.fromString('a') | ||
assert.equal(x.toString(), '0a1') | ||
assert.equal(x.toString(), '0a2') | ||
assert.isOk(x.edges['a'].final) | ||
@@ -51,0 +55,0 @@ }) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2299501
143
24809