Skip to content

Commit

Permalink
resolve merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneware committed May 16, 2014
2 parents 9441afa + f28a9ae commit 6fb6bcb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.js
Expand Up @@ -44,6 +44,9 @@ function keyfn(index) {
function fulltextPlan(idx, tokens, type) {
var db = this;
var s = (type === 'and') ? andStream(keyfn) : orStream();
if (tokens.length === 0) {
tokens.push('');
}
tokens.forEach(function (token) {
idx.createIndexStream({
start: [token, null],
Expand Down
24 changes: 24 additions & 0 deletions test/fulltext.js
Expand Up @@ -144,6 +144,30 @@ describe('fulltext-engine', function() {
}
});

it('should be able to search for a stopword and not hang', function(done) {
db = levelQuery(db);

db.query.use(fulltextEngine());
db.ensureIndex('doc', 'fulltext', fulltextEngine.index());

db.batch(testData(), doQuery);
function doQuery(err) {
if (err) return done(err);
var hits = 0;
db.query('doc', 'while')
.on('data', function (data) {
hits++;
})
.on('stats', function (stats) {
expect(stats).to.deep.equals(
{ indexHits: 0, dataHits: 0, matchHits: 0 });
})
.on('end', function () {
expect(hits).to.deep.equals(0);
done();
});
}
});
});

function testData() {
Expand Down

0 comments on commit 6fb6bcb

Please sign in to comment.