[Groonga-commit] groonga/groonga [master] add a test for two bigram indexes to _key. #798

Back to archive index

null+****@clear***** null+****@clear*****
2010年 12月 26日 (日) 08:08:35 JST


Kouhei Sutou	2010-12-25 23:08:35 +0000 (Sat, 25 Dec 2010)

  New Revision: b3cb5d46f397a498a53ac5e6d3bfc64b41b62bb2

  Log:
    add a test for two bigram indexes to _key. #798

  Modified files:
    test/unit/core/test-command-load.c

  Modified: test/unit/core/test-command-load.c (+42 -0)
===================================================================
--- test/unit/core/test-command-load.c    2010-12-24 05:03:17 +0000 (718c9cf)
+++ test/unit/core/test-command-load.c    2010-12-25 23:08:35 +0000 (4cf2559)
@@ -33,6 +33,7 @@ void test_null(gconstpointer data);
 void test_index_geo_point(void);
 void test_nonexistent_columns(void);
 void test_no_key_table(void);
+void test_two_bigram_indexes_to_key(void);
 
 static gchar *tmp_directory;
 
@@ -355,3 +356,44 @@ test_no_key_table(void)
                                        "'[[\"mori\", \"the author of groonga\"],"
                                        "[\"gunyara-kun\", \"co-author\"]]'"));
 }
+
+void
+test_two_bigram_indexes_to_key(void)
+{
+  cut_omit("crashed!!!");
+  assert_send_command("table_create Books TABLE_PAT_KEY ShortText");
+  assert_send_command("table_create Authors TABLE_PAT_KEY ShortText");
+  assert_send_command("table_create Bigram "
+                      "TABLE_PAT_KEY|KEY_NORMALIZE ShortText "
+                      "--default_tokenizer TokenBigram");
+  assert_send_command("table_create BigramLoose "
+                      "TABLE_PAT_KEY|KEY_NORMALIZE ShortText "
+                      "--default_tokenizer TokenBigramIgnoreBlankSplitSymbolAlphaDigit");
+  assert_send_command("column_create Books author COLUMN_SCALAR Authors");
+  assert_send_command("column_create Bigram author "
+                      "COLUMN_INDEX|WITH_POSITION Authors _key");
+  assert_send_command("column_create BigramLoose author "
+                      "COLUMN_INDEX|WITH_POSITION Authors _key");
+  cut_assert_equal_string(
+    "2",
+    send_command("load "
+                 "--table Books "
+                 "--columns '_key, author' "
+                 "--values "
+                 "'["
+                 "[\"The groonga book\", \"mori\"],"
+                 "[\"The first groonga\", \"morita\"]"
+                 "]'"));
+  cut_assert_equal_string(
+    "[[[2],"
+    "[[\"_key\",\"ShortText\"],"
+    "[\"author\",\"Authors\"],"
+    "[\"_score\",\"Int32\"]],"
+    "[\"The groonga book\",\"mori\",11],"
+    "[\"The first groonga\",\"morita\",1]]]",
+    send_command("select Books "
+                 "--match_columns "
+                 "'Bigram.author * 10 || BigramLoose.author * 1' "
+                 "--query 'mori' "
+                 "--output_columns '_key, author, _score'"));
+}




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