Skip to content

Commit

Permalink
feat(add): add is now a writable stream
Browse files Browse the repository at this point in the history
add is no a writable stream and not a transform stream. This makes it more difficult to track
progress, but makes the API much more robust
  • Loading branch information
fergiemcdowall committed Jun 23, 2017
1 parent 7f953a9 commit 9a171da
Show file tree
Hide file tree
Showing 28 changed files with 1,588 additions and 1,332 deletions.
2,707 changes: 1,515 additions & 1,192 deletions dist/search-index.js

Large diffs are not rendered by default.

30 changes: 13 additions & 17 deletions dist/search-index.min.js

Large diffs are not rendered by default.

30 changes: 13 additions & 17 deletions docs/demo/search-index.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "search-index",
"description": "A persistent full text search engine for the browser and Node.js",
"version": "0.11.3",
"version": "0.12.0",
"homepage": "https://github.com/fergiemcdowall/search-index",
"engines": {
"node": ">=4"
Expand All @@ -10,7 +10,7 @@
"dependencies": {
"bunyan": "^1.8.10",
"levelup": "^1.3.8",
"search-index-adder": "^0.2.5",
"search-index-adder": "^0.3.0",
"search-index-searcher": "^0.2.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion test/node/mocha-tests/328-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('bug 328', function() {
.on('data', function (data) {
// nowt
})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down
5 changes: 1 addition & 4 deletions test/node/mocha-tests/boost-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,7 @@ describe('boosting', function () {
si = thisSI
s.pipe(si.defaultPipeline())
.pipe(si.add())
.on('data', function (data) {
// nowt
})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down
3 changes: 1 addition & 2 deletions test/node/mocha-tests/bucket-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ describe('init the search index', function() {
getStream()
.pipe(index.defaultPipeline())
.pipe(index.add())
.on('data', function (data) {})
.on('end', function () {
.on('finish', function () {
return done()
})
})
Expand Down
7 changes: 2 additions & 5 deletions test/node/mocha-tests/delete-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('deleting: ', function () {
s.push(null)
s.pipe(si.defaultPipeline())
.pipe(si.add())
.on('data', function (data) {}).on('end', function () {
.on('finish', function () {
done()
})
})
Expand Down Expand Up @@ -102,10 +102,7 @@ describe('deleting: ', function () {
s.push(null)
s.pipe(si.defaultPipeline())
.pipe(si.add())
.on('data', function (data) {

})
.on('end', function () {
.on('finish', function () {
done()
})
})
Expand Down
3 changes: 1 addition & 2 deletions test/node/mocha-tests/facet-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ describe('categories: ', function () {
s.pipe(JSONStream.parse())
.pipe(si.defaultPipeline())
.pipe(si.add())
.on('data', function (data) {})
.on('end', function () {
.on('finish', function () {
return done()
})
})
Expand Down
7 changes: 2 additions & 5 deletions test/node/mocha-tests/fieldsToStore-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ describe('storing fields: ', function () {
}
}))
.pipe(si.add())
.on('data', function (data) {

})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down Expand Up @@ -161,7 +158,7 @@ describe('storing fields: ', function () {
.pipe(si2.add())
.on('data', function (data) {
})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down
5 changes: 1 addition & 4 deletions test/node/mocha-tests/flush-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@ describe('boosting', function () {
si = thisSI
s.pipe(si.defaultPipeline())
.pipe(si.add())
.on('data', function (data) {
// nowt
})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down
3 changes: 1 addition & 2 deletions test/node/mocha-tests/get-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ describe('.get-ting: ', function () {
})
s.push(null)
s.pipe(si.defaultPipeline())
.pipe(si.add())
.on('data', function (data) {}).on('end', function () {
.pipe(si.add()).on('finish', function () {
done()
})
})
Expand Down
3 changes: 1 addition & 2 deletions test/node/mocha-tests/indexing-test-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ describe('Indexing API', function () { // jshint ignore:line
var i = 0
s.pipe(si.defaultPipeline())
.pipe(si.add())
.on('data', function (data) {})
.on('end', function () {
.on('finish', function () {
si.dbReadStream()
.on('data', function (data) {
i++
Expand Down
28 changes: 13 additions & 15 deletions test/node/mocha-tests/indexing-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ describe('Indexing API', function () {
}
s.push(doc)
s.push(null)
s.pipe(si.defaultPipeline()).pipe(si.add())
.on('data', function (data) {})
.on('end', function () {
si.get(['1']).on('data', function (data) {
data.should.eql(doc)
})
.on('end', function () {
return done()
})
s.pipe(si.defaultPipeline())
.pipe(si.add())
.on('finish', function () {
si.get(['1'])
.on('data', function (data) {
data.should.eql(doc)
})
.on('end', function () {
return done()
})
})
})

Expand All @@ -54,8 +55,7 @@ describe('Indexing API', function () {
s.push(null)
s.pipe(si.defaultPipeline())
.pipe(si.add(undefined))
.on('data', function (data) {})
.on('end', function () {
.on('finish', function () {
si.get(['2']).on('data', function (data) {
data.should.eql(doc)
})
Expand All @@ -77,8 +77,7 @@ describe('Indexing API', function () {
s.pipe(si.defaultPipeline({
separator: /\s+/
})).pipe(si.add())
.on('data', function (data) {})
.on('end', function () {
.on('finish', function () {
si.search({
query: [{
AND: {'*': ['14.2.1.0']}
Expand All @@ -105,8 +104,7 @@ describe('Indexing API', function () {
s.pipe(si.defaultPipeline({
separator: /\s+/
})).pipe(si.add())
.on('data', function (data) {})
.on('end', function () {
.on('finish', function () {
si.search({
query: [{
AND: {'*': ['14.2.1.0']}
Expand Down
6 changes: 2 additions & 4 deletions test/node/mocha-tests/instantiation-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,15 @@ describe('Instantiation: ', function () {
it('should index test data into the first index', function (done) {
sOne.pipe(siOne.defaultPipeline())
.pipe(siOne.add())
.on('data', function (data) {})
.on('end', function () {
.on('finish', function () {
return done()
})
})

it('should index test data into the second index', function (done) {
sTwo.pipe(siTwo.defaultPipeline())
.pipe(siTwo.add())
.on('data', function (data) {})
.on('end', function () {
.on('finish', function () {
return done()
})
})
Expand Down
5 changes: 1 addition & 4 deletions test/node/mocha-tests/matching-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ describe('Matching epub: ', function () {
}
}))
.pipe(index.add())
.on('data', function (data) {
// nowt
})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down
5 changes: 1 addition & 4 deletions test/node/mocha-tests/or-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ describe('OR-ing: ', function () {
si = thisSI
s.pipe(si.defaultPipeline())
.pipe(si.add())
.on('data', function (data) {

})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down
20 changes: 4 additions & 16 deletions test/node/mocha-tests/phrase-search-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ describe('ngrams (phrase search): ', function () {
nGramLength: {gte: 1, lte: 3}
}))
.pipe(si.add())
.on('data', function (data) {

})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand All @@ -70,10 +67,7 @@ describe('ngrams (phrase search): ', function () {
nGramLength: [1, 5]
}))
.pipe(si2.add())
.on('data', function (data) {

})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand All @@ -100,10 +94,7 @@ describe('ngrams (phrase search): ', function () {
}
}))
.pipe(si3.add())
.on('data', function (data) {

})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand All @@ -127,10 +118,7 @@ describe('ngrams (phrase search): ', function () {
}
}))
.pipe(si4.add())
.on('data', function (data) {

})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down
4 changes: 2 additions & 2 deletions test/node/mocha-tests/preserve-case-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('testing case: ', function () {
preserveCase: true
}))
.pipe(si.add())
.on('data', function (data) {}).on('end', function () {
.on('finish', function () {
done()
})
})
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('testing case: ', function () {
preserveCase: false
}))
.pipe(si2.add())
.on('data', function (data) {}).on('end', function () {
.on('finish', function () {
done()
})
})
Expand Down
5 changes: 1 addition & 4 deletions test/node/mocha-tests/relevancy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ describe('some simple relevancy tests: ', function () {
si = thisSI
s.pipe(si.defaultPipeline())
.pipe(si.add())
.on('data', function (data) {

})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down
5 changes: 1 addition & 4 deletions test/node/mocha-tests/scan-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ describe('scanning: ', function () {
si = thisSi
s.pipe(si.defaultPipeline())
.pipe(si.add())
.on('data', function (data) {

})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down
4 changes: 1 addition & 3 deletions test/node/mocha-tests/search-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ describe('simple search test', function() {
})
.pipe(si.defaultPipeline())
.pipe(si.add())
.on('data', function (d) {
})
.on('end', function () {
.on('finish', function () {
i.should.be.exactly(10)
return done()
})
Expand Down
5 changes: 1 addition & 4 deletions test/node/mocha-tests/sorting-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,7 @@ describe('sorting: ', function () {
}
}))
.pipe(si.add())
.on('data', function (data) {

})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down
4 changes: 1 addition & 3 deletions test/node/mocha-tests/sqlite-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ describe('sqllite compatability: ', function () {
s.push(null)
s.pipe(si.defaultPipeline())
.pipe(si.add())
.on('data', function (data) {
})
.on('end', function () {
.on('finish', function () {
si.search({
query: [{
AND: {'*': ['cool']}
Expand Down
6 changes: 3 additions & 3 deletions test/node/mocha-tests/stopword-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('stopwords: ', function () {
.pipe(si.add())
.on('data', function (data) {
})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down Expand Up @@ -113,7 +113,7 @@ describe('stopwords: ', function () {
.pipe(siNO.add())
.on('data', function (data) {
})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down Expand Up @@ -164,7 +164,7 @@ describe('stopwords: ', function () {
.pipe(siFood.add())
.on('data', function (data) {
})
.on('end', function () {
.on('finish', function () {
true.should.be.exactly(true)
return done()
})
Expand Down
2 changes: 1 addition & 1 deletion test/node/mocha-tests/stream-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('stopwords: ', function () {
.pipe(JSONStream.parse())
.pipe(si.defaultPipeline())
.pipe(si.add())
.on('data', function (data) {}).on('end', function () {
.on('data', function (data) {}).on('finish', function () {
done()
})
})
Expand Down
Loading

0 comments on commit 9a171da

Please sign in to comment.