Navigation Menu

Skip to content

Commit

Permalink
bq: throw exception for no min and max range
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 6, 2012
1 parent 864cce6 commit db7b052
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/bq-translator.js
Expand Up @@ -333,8 +333,7 @@ BooleanQueryTranslator.prototype = {
if (is_range) {
var expressions = [];
if (min.length == 0 && max.length == 0) {
// TODO: report error: only ".."
return "";
this.throwTranslateError("both min and max are missing");
}
if (min.length > 0) {
expressions.push(field + " >= " + min);
Expand Down
5 changes: 5 additions & 0 deletions test/bq-translator.test.js
Expand Up @@ -293,4 +293,9 @@ suite('BoolanQueryTranslator', function() {
"'\"keyword",
"'\"keyword||",
"close double quote for phrase is missing");

testExpressionError("value only: unsigned integer range: no min and max",
"..",
"..||",
"both min and max are missing");
});

0 comments on commit db7b052

Please sign in to comment.