[Groonga-commit] groonga/gcs [master] bq: throw exception for no operator

Back to archive index

null+****@clear***** null+****@clear*****
2012年 8月 6日 (月) 14:45:11 JST


Kouhei Sutou	2012-08-06 14:45:11 +0900 (Mon, 06 Aug 2012)

  New Revision: 192b430d0236be921c879841cf3736d0fabc36e2
  https://github.com/groonga/gcs/commit/192b430d0236be921c879841cf3736d0fabc36e2

  Log:
    bq: throw exception for no operator

  Modified files:
    lib/bq-translator.js
    test/bq-translator.test.js

  Modified: lib/bq-translator.js (+2 -1)
===================================================================
--- lib/bq-translator.js    2012-08-06 14:40:30 +0900 (3656d67)
+++ lib/bq-translator.js    2012-08-06 14:45:11 +0900 (70347d8)
@@ -258,7 +258,8 @@ BooleanQueryTranslator.prototype = {
         value += character;
       } else if (character == "\"") {
         if (value.length > 0) {
-          this.throwTranslateError("TODO");
+          this.throwTranslateError("operator is missing: " +
+                                   "keyword:<" + value + ">");
         }
         tokens.push(this.translateExpressionValuePhrase(field));
         this.offset--;

  Modified: test/bq-translator.test.js (+8 -3)
===================================================================
--- test/bq-translator.test.js    2012-08-06 14:40:30 +0900 (de43047)
+++ test/bq-translator.test.js    2012-08-06 14:45:11 +0900 (78ae0a9)
@@ -271,8 +271,13 @@ suite('BoolanQueryTranslator', function() {
                       "f1:|v|alue",
                       "invalid value: field:<f1>");
 
-  testExpressionError("field value: string: missing close quote",
-                      "f1:'k1",
-                      "f1:'k1||",
+  testExpressionError("value only: string: missing close quote",
+                      "'k1",
+                      "'k1||",
                       "close single quote for string value is missing");
+  testExpressionError("value only: stirng: " +
+                      "missing operator between keyword and phrase",
+                      "'keyword1\"keyword2\"' 'other keyword'",
+                      "'keyword1|\"|keyword2\"' 'other keyword'",
+                      "operator is missing: keyword:<keyword1>");
 });
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
다운로드 



Groonga-commit メーリングリストの案内
Back to archive index