[Groonga-commit] groonga/groonga [master] Support near search for _key pseudo column

Back to archive index

null+****@clear***** null+****@clear*****
2012年 7月 9日 (月) 14:00:39 JST


Kouhei Sutou	2012-07-09 14:00:39 +0900 (Mon, 09 Jul 2012)

  New Revision: 32bdcd4ef9a632d6b8b78d3659cca828910239c8
  https://github.com/groonga/groonga/commit/32bdcd4ef9a632d6b8b78d3659cca828910239c8

  Merged 14e5160: Merge pull request #19 from groonga/near-search-support-key

  Log:
    Support near search for _key pseudo column

  Added files:
    test/function/suite/select/filter/near/index_key.expected
    test/function/suite/select/filter/near/index_key.test
  Modified files:
    lib/db.c

  Modified: lib/db.c (+2 -0)
===================================================================
--- lib/db.c    2012-07-09 13:57:21 +0900 (3c6cf6c)
+++ lib/db.c    2012-07-09 14:00:39 +0900 (da62371)
@@ -8261,6 +8261,8 @@ grn_column_index(grn_ctx *ctx, grn_obj *obj, grn_operator op,
       }
       break;
     case GRN_OP_MATCH :
+    case GRN_OP_NEAR :
+    case GRN_OP_NEAR2 :
     case GRN_OP_SIMILAR :
       {
         grn_accessor *a = (grn_accessor *)obj;

  Added: test/function/suite/select/filter/near/index_key.expected (+45 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/select/filter/near/index_key.expected    2012-07-09 14:00:39 +0900 (88d927b)
@@ -0,0 +1,45 @@
+table_create Entries TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+table_create Terms TABLE_PAT_KEY|KEY_NORMALIZE ShortText --default_tokenizer TokenBigram
+[[0,0.0,0.0],true]
+column_create Terms entries_key_index COLUMN_INDEX|WITH_POSITION Entries _key
+[[0,0.0,0.0],true]
+load --table Entries
+[
+{"_key": "Welcome! This is my first post!"},
+{"_key": "I started to use groonga. It's very fast!"},
+{"_key": "I also started to use mroonga. It's also very fast! Really fast!"},
+{"_key": "I also started to use mroonga. It's also very very fast!"},
+{"_key": "I migrated all Senna system!"},
+{"_key": "I also migrated all Tritonn system!"}
+]
+[[0,0.0,0.0],6]
+select Entries --filter '_key *N "I fast"' --output_columns '_key, _score'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        1
+      ],
+      [
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "_score",
+          "Int32"
+        ]
+      ],
+      [
+        "I started to use groonga. It's very fast!",
+        1
+      ]
+    ]
+  ]
+]

  Added: test/function/suite/select/filter/near/index_key.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/select/filter/near/index_key.test    2012-07-09 14:00:39 +0900 (20b96dc)
@@ -0,0 +1,16 @@
+table_create Entries TABLE_HASH_KEY ShortText
+
+table_create Terms TABLE_PAT_KEY|KEY_NORMALIZE ShortText --default_tokenizer TokenBigram
+column_create Terms entries_key_index COLUMN_INDEX|WITH_POSITION Entries _key
+
+load --table Entries
+[
+{"_key": "Welcome! This is my first post!"},
+{"_key": "I started to use groonga. It's very fast!"},
+{"_key": "I also started to use mroonga. It's also very fast! Really fast!"},
+{"_key": "I also started to use mroonga. It's also very very fast!"},
+{"_key": "I migrated all Senna system!"},
+{"_key": "I also migrated all Tritonn system!"}
+]
+
+select Entries --filter '_key *N "I fast"' --output_columns '_key, _score'
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
下载 



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