Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ function add(left, right) {
return left + right;
}

// add HTML tags as seperators.
lunr.tokenizer.seperator = /[\s\-]+|<.+?>/;

// get all the tokens found in the given text (non-unique)
// in the future, we might expand this to do more than just
// English. Also, this is a private Lunr API, hence why
Expand Down
2 changes: 1 addition & 1 deletion test/docs/test-docs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ function tests(dbName, dbType) {
});
});

it('basic search with html tags', function () {
return db.bulkDocs({docs: docs}).then(function () {
var opts = {
fields: ['title', 'text', 'desc'],
query: 'concurrent'
};
return db.search(opts);
}).then(function (res) {
res.rows.length.should.equal(1);
res.rows[0].id.should.equal('3');
res.rows[0].score.should.be.above(0);
});
});

it('basic search - zero results', function () {
return db.bulkDocs({docs: docs}).then(function () {
var opts = {
Expand Down Expand Up @@ -786,6 +800,5 @@ function tests(dbName, dbType) {
res.total_rows.should.equal(2);
});
});

});
}