Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support grammer whitespace between colon(:) and term #13

Merged
merged 1 commit into from Nov 24, 2017
Merged
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
2 changes: 1 addition & 1 deletion lib/lucene.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ field_exp
}

fieldname
= fieldname:unquoted_term [:]
= fieldname:unquoted_term [:] _*
{
return fieldname;
}
Expand Down
19 changes: 15 additions & 4 deletions lib/queryParser.js

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

7 changes: 7 additions & 0 deletions test/queryParser_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ describe('queryParser', () => {
expect(results['left']['term']).to.equal('Foo');
});

it('handles whitespace between colon and term', () => {
var results = lucene.parse('foo: bar');

expect(results['left']['field']).to.equal('foo');
expect(results['left']['term']).to.equal('bar');
});

function isEmpty(arr) {
for (var i in arr) {
return false;
Expand Down