Skip to content

Commit ee4a8f9

Browse files
bleroyolivernn
authored andcommitted
Complete set union is complete
Fixes #469
1 parent 9ede3d3 commit ee4a8f9

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ lunr.Index.prototype.query = function (fn) {
167167
*/
168168
var clause = query.clauses[i],
169169
terms = null,
170-
clauseMatches = lunr.Set.complete
170+
clauseMatches = lunr.Set.empty
171171

172172
if (clause.usePipeline) {
173173
terms = this.pipeline.runString(clause.term, {

lib/set.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ lunr.Set.complete = {
3535
},
3636

3737
union: function (other) {
38-
return other
38+
return this
3939
},
4040

4141
contains: function () {

test/set_test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,18 @@ suite('lunr.Set', function () {
3333
})
3434

3535
suite('complete set', function () {
36-
test('contains element', function () {
36+
test('union is complete', function () {
3737
var result = lunr.Set.complete.union(this.set)
3838
assert.isOk(result.contains('foo'))
39+
assert.isOk(result.contains('bar'))
3940
})
4041
})
4142

4243
suite('empty set', function () {
4344
test('contains element', function () {
4445
var result = lunr.Set.empty.union(this.set)
4546
assert.isOk(result.contains('foo'))
47+
assert.isNotOk(result.contains('bar'))
4648
})
4749
})
4850

@@ -90,6 +92,7 @@ suite('lunr.Set', function () {
9092
test('contains element', function () {
9193
var result = lunr.Set.complete.intersect(this.set)
9294
assert.isOk(result.contains('foo'))
95+
assert.isNotOk(result.contains('bar'))
9396
})
9497
})
9598

@@ -136,6 +139,7 @@ suite('lunr.Set', function () {
136139
result = target.intersect(lunr.Set.complete)
137140

138141
assert.isOk(result.contains('foo'))
142+
assert.isNotOk(result.contains('bar'))
139143
})
140144
})
141145
})

0 commit comments

Comments
 (0)