[Groonga-commit] groonga/groonga at 836d5eb [master] ii: support ordered search by specifying -1 as max interval

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Jan 12 11:32:58 JST 2017


Kouhei Sutou	2017-01-12 11:32:58 +0900 (Thu, 12 Jan 2017)

  New Revision: 836d5eb9ab97fc23a974fa3da8c4d480d49ccd4a
  https://github.com/groonga/groonga/commit/836d5eb9ab97fc23a974fa3da8c4d480d49ccd4a

  Message:
    ii: support ordered search by specifying -1 as max interval

  Added files:
    test/command/suite/select/query/near_search/custom_max_interval/ordered.expected
    test/command/suite/select/query/near_search/custom_max_interval/ordered.test
  Modified files:
    lib/ii.c

  Modified: lib/ii.c (+1 -1)
===================================================================
--- lib/ii.c    2017-01-07 22:29:04 +0900 (e3c1710)
+++ lib/ii.c    2017-01-12 11:32:58 +0900 (8028667)
@@ -7975,7 +7975,7 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii,
                 rc = ctx->rc;
                 goto exit;
               }
-              if (max - min <= max_interval) {
+              if ((max_interval < 0) || (max - min <= max_interval)) {
                 if (rep) { pi.pos = min; res_add(ctx, s, &pi, weight, op); }
                 noccur++;
                 if (ti->pos == max + 1) {

  Added: test/command/suite/select/query/near_search/custom_max_interval/ordered.expected (+47 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/query/near_search/custom_max_interval/ordered.expected    2017-01-12 11:32:58 +0900 (109a812)
@@ -0,0 +1,47 @@
+table_create Memos TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Memos content COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Terms TABLE_PAT_KEY ShortText   --default_tokenizer TokenBigram   --normalizer NormalizerAuto
+[[0,0.0,0.0],true]
+column_create Terms memos_content COLUMN_INDEX|WITH_POSITION Memos content
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"_key":"alphabets", "content": "a b c d e f g i j k l m n o p q r s t u v w x y z"}
+]
+[[0,0.0,0.0],1]
+select --table Memos --match_columns content --query '*N-1"a z"'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        1
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "content",
+          "ShortText"
+        ]
+      ],
+      [
+        1,
+        "alphabets",
+        "a b c d e f g i j k l m n o p q r s t u v w x y z"
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/query/near_search/custom_max_interval/ordered.test (+14 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/query/near_search/custom_max_interval/ordered.test    2017-01-12 11:32:58 +0900 (b67323d)
@@ -0,0 +1,14 @@
+table_create Memos TABLE_PAT_KEY ShortText
+column_create Memos content COLUMN_SCALAR ShortText
+
+table_create Terms TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create Terms memos_content COLUMN_INDEX|WITH_POSITION Memos content
+
+load --table Memos
+[
+{"_key":"alphabets", "content": "a b c d e f g i j k l m n o p q r s t u v w x y z"}
+]
+
+select --table Memos --match_columns content --query '*N-1"a z"'
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index