[Groonga-commit] groonga/groonga at cfaa5da [master] select: deprecate --sortby and --drilldown_sortby

Back to archive index

Kouhei Sutou null+****@clear*****
Fri May 20 09:41:56 JST 2016


Kouhei Sutou	2016-05-20 09:41:56 +0900 (Fri, 20 May 2016)

  New Revision: cfaa5daf0f9ade05fc3835c68b8a296944273e4d
  https://github.com/groonga/groonga/commit/cfaa5daf0f9ade05fc3835c68b8a296944273e4d

  Message:
    select: deprecate --sortby and --drilldown_sortby
    
    Use --sort_keys and --drilldown_sort_keys instead. --sortby and
    --drilldown_sortby are still available for backward compatibility.

  Added files:
    test/command/suite/select/drilldown/labeled/sort_keys/sub_record_column/multiple.expected
    test/command/suite/select/drilldown/labeled/sort_keys/sub_record_column/multiple.test
    test/command/suite/select/drilldown/plain/sort_keys.expected
    test/command/suite/select/drilldown/plain/sort_keys.test
    test/command/suite/select/drilldown/plain/sortby.expected
    test/command/suite/select/drilldown/plain/sortby.test
    test/command/suite/select/sort_keys/geo/distance/limit.test
    test/command/suite/select/sort_keys/geo/distance/no_limit.test
    test/command/suite/select/sort_keys/geo/distance/offset_and_limit.test
  Copied files:
    test/command/suite/select/sort_keys/compressed.expected
      (from test/command/suite/select/sort/compressed.expected)
    test/command/suite/select/sort_keys/compressed.test
      (from test/command/suite/select/sort/compressed.test)
    test/command/suite/select/sort_keys/geo/distance/limit.expected
      (from test/command/suite/select/sort/geo/distance/limit.expected)
    test/command/suite/select/sort_keys/geo/distance/no_limit.expected
      (from test/command/suite/select/sort/geo/distance/no_limit.expected)
    test/command/suite/select/sort_keys/geo/distance/not_indexed.expected
      (from test/command/suite/select/sort/geo/distance/not_indexed.expected)
    test/command/suite/select/sort_keys/geo/distance/not_indexed.test
      (from test/command/suite/select/sort/geo/distance/not_indexed.test)
    test/command/suite/select/sort_keys/geo/distance/offset_and_limit.expected
      (from test/command/suite/select/sort/geo/distance/offset_and_limit.expected)
    test/command/suite/select/sort_keys/geo/distance/with_condition.expected
      (from test/command/suite/select/sort/geo/distance/with_condition.expected)
    test/command/suite/select/sort_keys/geo/distance/with_condition.test
      (from test/command/suite/select/sort/geo/distance/with_condition.test)
    test/command/suite/select/sort_keys/geo/distance/without_condition.expected
      (from test/command/suite/select/sort/geo/distance/without_condition.expected)
    test/command/suite/select/sort_keys/geo/distance/without_condition.test
      (from test/command/suite/select/sort/geo/distance/without_condition.test)
    test/command/suite/select/sort_keys/index.expected
      (from test/command/suite/select/sort/index.expected)
    test/command/suite/select/sort_keys/index.test
      (from test/command/suite/select/sort/index.test)
    test/command/suite/select/sort_keys/key/double_array_trie.expected
      (from test/command/suite/select/sort/key/double_array_trie.expected)
    test/command/suite/select/sort_keys/key/double_array_trie.test
      (from test/command/suite/select/sort/key/double_array_trie.test)
    test/command/suite/select/sort_keys/key/hash_key.expected
      (from test/command/suite/select/sort/key/hash_key.expected)
    test/command/suite/select/sort_keys/key/hash_key.test
      (from test/command/suite/select/sort/key/hash_key.test)
    test/command/suite/select/sort_keys/key/patricia_trie.expected
      (from test/command/suite/select/sort/key/patricia_trie.expected)
    test/command/suite/select/sort_keys/key/patricia_trie.test
      (from test/command/suite/select/sort/key/patricia_trie.test)
    test/command/suite/select/sort_keys/string_use_8bit.expected
      (from test/command/suite/select/sort/string_use_8bit.expected)
    test/command/suite/select/sort_keys/string_use_8bit.test
      (from test/command/suite/select/sort/string_use_8bit.test)
  Modified files:
    lib/proc/proc_select.c
  Renamed files:
    test/command/suite/select/sortby/compressed.expected
      (from test/command/suite/select/sort/compressed.expected)
    test/command/suite/select/sortby/compressed.test
      (from test/command/suite/select/sort/compressed.test)
    test/command/suite/select/sortby/geo/distance/limit.expected
      (from test/command/suite/select/sort/geo/distance/limit.expected)
    test/command/suite/select/sortby/geo/distance/limit.test
      (from test/command/suite/select/sort/geo/distance/limit.test)
    test/command/suite/select/sortby/geo/distance/no_limit.expected
      (from test/command/suite/select/sort/geo/distance/no_limit.expected)
    test/command/suite/select/sortby/geo/distance/no_limit.test
      (from test/command/suite/select/sort/geo/distance/no_limit.test)
    test/command/suite/select/sortby/geo/distance/not_indexed.expected
      (from test/command/suite/select/sort/geo/distance/not_indexed.expected)
    test/command/suite/select/sortby/geo/distance/not_indexed.test
      (from test/command/suite/select/sort/geo/distance/not_indexed.test)
    test/command/suite/select/sortby/geo/distance/offset_and_limit.expected
      (from test/command/suite/select/sort/geo/distance/offset_and_limit.expected)
    test/command/suite/select/sortby/geo/distance/offset_and_limit.test
      (from test/command/suite/select/sort/geo/distance/offset_and_limit.test)
    test/command/suite/select/sortby/geo/distance/with_condition.expected
      (from test/command/suite/select/sort/geo/distance/with_condition.expected)
    test/command/suite/select/sortby/geo/distance/with_condition.test
      (from test/command/suite/select/sort/geo/distance/with_condition.test)
    test/command/suite/select/sortby/geo/distance/without_condition.expected
      (from test/command/suite/select/sort/geo/distance/without_condition.expected)
    test/command/suite/select/sortby/geo/distance/without_condition.test
      (from test/command/suite/select/sort/geo/distance/without_condition.test)
    test/command/suite/select/sortby/index.expected
      (from test/command/suite/select/sort/index.expected)
    test/command/suite/select/sortby/index.test
      (from test/command/suite/select/sort/index.test)
    test/command/suite/select/sortby/key/double_array_trie.expected
      (from test/command/suite/select/sort/key/double_array_trie.expected)
    test/command/suite/select/sortby/key/double_array_trie.test
      (from test/command/suite/select/sort/key/double_array_trie.test)
    test/command/suite/select/sortby/key/hash_key.expected
      (from test/command/suite/select/sort/key/hash_key.expected)
    test/command/suite/select/sortby/key/hash_key.test
      (from test/command/suite/select/sort/key/hash_key.test)
    test/command/suite/select/sortby/key/patricia_trie.expected
      (from test/command/suite/select/sort/key/patricia_trie.expected)
    test/command/suite/select/sortby/key/patricia_trie.test
      (from test/command/suite/select/sort/key/patricia_trie.test)
    test/command/suite/select/sortby/string_use_8bit.expected
      (from test/command/suite/select/sort/string_use_8bit.expected)
    test/command/suite/select/sortby/string_use_8bit.test
      (from test/command/suite/select/sort/string_use_8bit.test)

  Modified: lib/proc/proc_select.c (+52 -28)
===================================================================
--- lib/proc/proc_select.c    2016-05-20 09:21:55 +0900 (97e12a9)
+++ lib/proc/proc_select.c    2016-05-20 09:41:56 +0900 (e1fc4b0)
@@ -85,7 +85,7 @@ typedef struct {
 typedef struct {
   grn_select_string label;
   grn_select_string keys;
-  grn_select_string sortby;
+  grn_select_string sort_keys;
   grn_select_string output_columns;
   int offset;
   int limit;
@@ -104,7 +104,7 @@ typedef struct {
   grn_select_string query;
   grn_select_string filter;
   grn_select_string scorer;
-  grn_select_string sortby;
+  grn_select_string sort_keys;
   grn_select_string output_columns;
   int offset;
   int limit;
@@ -606,7 +606,7 @@ static void
 grn_drilldown_data_fill(grn_ctx *ctx,
                         grn_drilldown_data *drilldown,
                         grn_obj *keys,
-                        grn_obj *sortby,
+                        grn_obj *sort_keys,
                         grn_obj *output_columns,
                         grn_obj *offset,
                         grn_obj *limit,
@@ -617,7 +617,7 @@ grn_drilldown_data_fill(grn_ctx *ctx,
 {
   GRN_SELECT_FILL_STRING(drilldown->keys, keys);
 
-  GRN_SELECT_FILL_STRING(drilldown->sortby, sortby);
+  GRN_SELECT_FILL_STRING(drilldown->sort_keys, sort_keys);
 
   GRN_SELECT_FILL_STRING(drilldown->output_columns, output_columns);
   if (drilldown->output_columns.length == 0) {
@@ -1387,12 +1387,12 @@ grn_select_drilldown(grn_ctx *ctx,
     limit = drilldown->limit;
     grn_normalize_offset_and_limit(ctx, n_hits, &offset, &limit);
 
-    if (drilldown->sortby.length > 0) {
+    if (drilldown->sort_keys.length > 0) {
       grn_table_sort_key *sort_keys;
       uint32_t n_sort_keys;
       sort_keys = grn_table_sort_key_from_str(ctx,
-                                              drilldown->sortby.value,
-                                              drilldown->sortby.length,
+                                              drilldown->sort_keys.value,
+                                              drilldown->sort_keys.length,
                                               target_table, &n_sort_keys);
       if (sort_keys) {
         grn_obj *sorted;
@@ -1642,12 +1642,12 @@ grn_select_drilldowns_output(grn_ctx *ctx,
     limit = drilldown->limit;
     grn_normalize_offset_and_limit(ctx, n_hits, &offset, &limit);
 
-    if (drilldown->sortby.length > 0) {
+    if (drilldown->sort_keys.length > 0) {
       grn_table_sort_key *sort_keys;
       uint32_t n_sort_keys;
       sort_keys = grn_table_sort_key_from_str(ctx,
-                                              drilldown->sortby.value,
-                                              drilldown->sortby.length,
+                                              drilldown->sort_keys.value,
+                                              drilldown->sort_keys.length,
                                               target_table, &n_sort_keys);
       if (sort_keys) {
         grn_obj *sorted;
@@ -1734,7 +1734,7 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
     data->query.length + 1 +
     data->filter.length + 1 +
     data->scorer.length + 1 +
-    data->sortby.length + 1 +
+    data->sort_keys.length + 1 +
     data->output_columns.length + 1 +
     data->match_escalation_threshold.length + 1 +
     data->query_expander.length + 1 +
@@ -1762,7 +1762,7 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
       grn_hash_cursor_get_value(ctx, cursor, (void **)&drilldown);
       cache_key_size +=
         drilldown->keys.length + 1 +
-        drilldown->sortby.length + 1 +
+        drilldown->sort_keys.length + 1 +
         drilldown->output_columns.length + 1 +
         drilldown->label.length + 1 +
         drilldown->calc_target_name.length + 1 +
@@ -1786,7 +1786,7 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
     PUT_CACHE_KEY(data->query);
     PUT_CACHE_KEY(data->filter);
     PUT_CACHE_KEY(data->scorer);
-    PUT_CACHE_KEY(data->sortby);
+    PUT_CACHE_KEY(data->sort_keys);
     PUT_CACHE_KEY(data->output_columns);
     if (data->slices) {
       GRN_HASH_EACH_BEGIN(ctx, data->slices, cursor, id) {
@@ -1807,7 +1807,7 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
         grn_drilldown_data *drilldown;
         grn_hash_cursor_get_value(ctx, cursor, (void **)&drilldown);
         PUT_CACHE_KEY(drilldown->keys);
-        PUT_CACHE_KEY(drilldown->sortby);
+        PUT_CACHE_KEY(drilldown->sort_keys);
         PUT_CACHE_KEY(drilldown->output_columns);
         PUT_CACHE_KEY(drilldown->label);
         PUT_CACHE_KEY(drilldown->calc_target_name);
@@ -1872,8 +1872,8 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
                               data->filter.length - 1,
                               data->scorer.value,
                               data->scorer.length,
-                              data->sortby.value,
-                              data->sortby.length,
+                              data->sort_keys.value,
+                              data->sort_keys.length,
                               data->output_columns.value,
                               data->output_columns.length,
                               data->offset,
@@ -2105,10 +2105,10 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
       grn_normalize_offset_and_limit(ctx, nhits,
                                      &(data->offset), &(data->limit));
 
-      if (data->sortby.length > 0 &&
+      if (data->sort_keys.length > 0 &&
           (keys = grn_table_sort_key_from_str(ctx,
-                                              data->sortby.value,
-                                              data->sortby.length,
+                                              data->sort_keys.value,
+                                              data->sort_keys.length,
                                               res,
                                               &nkeys))) {
         if ((sorted = grn_table_create(ctx, NULL, 0, NULL,
@@ -2428,6 +2428,7 @@ grn_select_data_fill_drilldowns(grn_ctx *ctx,
   if (GRN_TEXT_LEN(drilldown) > 0) {
     grn_drilldown_data *drilldown_data;
     const char *anonymous_label = "_anonymous";
+    grn_obj *sort_keys;
 
     drilldown_data = grn_select_data_drilldowns_add(ctx,
                                                     data,
@@ -2438,11 +2439,18 @@ grn_select_data_fill_drilldowns(grn_ctx *ctx,
     }
     drilldown_data->label.value = NULL;
     drilldown_data->label.length = 0;
+
+    sort_keys = grn_plugin_proc_get_var(ctx, user_data,
+                                        "drilldown_sort_keys", -1);
+    if (GRN_TEXT_LEN(sort_keys) == 0) {
+      /* For backward compatibility */
+      sort_keys = grn_plugin_proc_get_var(ctx, user_data,
+                                          "drilldown_sortby", -1);
+    }
     grn_drilldown_data_fill(ctx,
                             drilldown_data,
                             drilldown,
-                            grn_plugin_proc_get_var(ctx, user_data,
-                                                    "drilldown_sortby", -1),
+                            sort_keys,
                             grn_plugin_proc_get_var(ctx, user_data,
                                                     "drilldown_output_columns",
                                                     -1),
@@ -2469,7 +2477,7 @@ grn_select_data_fill_drilldowns(grn_ctx *ctx,
       char drilldown_label[GRN_TABLE_MAX_KEY_SIZE];
       char key_name[GRN_TABLE_MAX_KEY_SIZE];
       grn_obj *keys;
-      grn_obj *sortby;
+      grn_obj *sort_keys;
       grn_obj *output_columns;
       grn_obj *offset;
       grn_obj *limit;
@@ -2502,7 +2510,12 @@ grn_select_data_fill_drilldowns(grn_ctx *ctx,
       name = grn_plugin_proc_get_var(ctx, user_data, key_name, -1);
 
       GET_VAR(keys);
-      GET_VAR(sortby);
+      GET_VAR(sort_keys);
+      if (!sort_keys) {
+        grn_obj *sortby;
+        GET_VAR(sortby);
+        sort_keys = sortby;
+      }
       GET_VAR(output_columns);
       GET_VAR(offset);
       GET_VAR(limit);
@@ -2516,7 +2529,7 @@ grn_select_data_fill_drilldowns(grn_ctx *ctx,
       grn_drilldown_data_fill(ctx,
                               drilldown,
                               keys,
-                              sortby,
+                              sort_keys,
                               output_columns,
                               offset,
                               limit,
@@ -2559,10 +2572,17 @@ command_select(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data
     grn_plugin_proc_get_var_string(ctx, user_data,
                                    "scorer", -1,
                                    &(data.scorer.length));
-  data.sortby.value =
+  data.sort_keys.value =
     grn_plugin_proc_get_var_string(ctx, user_data,
-                                   "sortby", -1,
-                                   &(data.sortby.length));
+                                   "sort_keys", -1,
+                                   &(data.sort_keys.length));
+  if (data.sort_keys.length == 0) {
+    /* For backward compatibility */
+    data.sort_keys.value =
+      grn_plugin_proc_get_var_string(ctx, user_data,
+                                     "sortby", -1,
+                                     &(data.sort_keys.length));
+  }
   data.output_columns.value =
     grn_plugin_proc_get_var_string(ctx, user_data,
                                    "output_columns", -1,
@@ -2643,7 +2663,7 @@ exit :
   return NULL;
 }
 
-#define N_VARS 24
+#define N_VARS 26
 #define DEFINE_VARS grn_expr_var vars[N_VARS]
 
 static void
@@ -2655,11 +2675,13 @@ init_vars(grn_ctx *ctx, grn_expr_var *vars)
   grn_plugin_expr_var_init(ctx, &(vars[3]), "query", -1);
   grn_plugin_expr_var_init(ctx, &(vars[4]), "filter", -1);
   grn_plugin_expr_var_init(ctx, &(vars[5]), "scorer", -1);
+  /* Deprecated since 6.0.3. Use sort_keys instead. */
   grn_plugin_expr_var_init(ctx, &(vars[6]), "sortby", -1);
   grn_plugin_expr_var_init(ctx, &(vars[7]), "output_columns", -1);
   grn_plugin_expr_var_init(ctx, &(vars[8]), "offset", -1);
   grn_plugin_expr_var_init(ctx, &(vars[9]), "limit", -1);
   grn_plugin_expr_var_init(ctx, &(vars[10]), "drilldown", -1);
+  /* Deprecated since 6.0.3. Use drilldown_sort_keys instead. */
   grn_plugin_expr_var_init(ctx, &(vars[11]), "drilldown_sortby", -1);
   grn_plugin_expr_var_init(ctx, &(vars[12]), "drilldown_output_columns", -1);
   grn_plugin_expr_var_init(ctx, &(vars[13]), "drilldown_offset", -1);
@@ -2674,6 +2696,8 @@ init_vars(grn_ctx *ctx, grn_expr_var *vars)
   grn_plugin_expr_var_init(ctx, &(vars[21]), "drilldown_calc_types", -1);
   grn_plugin_expr_var_init(ctx, &(vars[22]), "drilldown_calc_target", -1);
   grn_plugin_expr_var_init(ctx, &(vars[23]), "drilldown_filter", -1);
+  grn_plugin_expr_var_init(ctx, &(vars[24]), "sort_keys", -1);
+  grn_plugin_expr_var_init(ctx, &(vars[25]), "drilldown_sort_keys", -1);
 }
 
 void

  Added: test/command/suite/select/drilldown/labeled/sort_keys/sub_record_column/multiple.expected (+121 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/labeled/sort_keys/sub_record_column/multiple.expected    2016-05-20 09:41:56 +0900 (eac60ab)
@@ -0,0 +1,121 @@
+table_create Tags TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+table_create Memos TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Memos tag COLUMN_SCALAR Tags
+[[0,0.0,0.0],true]
+column_create Memos date COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"_key": "Rroonga is fast!", "tag": "Rroonga", "date": "2014-11-17 00:00:00"},
+{"_key": "Mroonga is fast!", "tag": "Mroonga", "date": "2014-11-16 00:00:00"},
+{"_key": "Groonga is fast!", "tag": "Groonga", "date": "2014-11-16 00:00:00"},
+{"_key": "Groonga sticker!", "tag": "Groonga", "date": "2014-11-16 00:00:00"},
+{"_key": "Groonga is good!", "tag": "Groonga", "date": "2014-11-17 00:00:00"}
+]
+[[0,0.0,0.0],5]
+select Memos   --command_version 2   --filter true   --drilldown[tag].keys tag,date   --drilldown[tag].output_columns _key[0],_key[1],_nsubrecs   --drilldown[tag].sort_keys _value.tag._key,_value.date
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        5
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "date",
+          "Time"
+        ],
+        [
+          "tag",
+          "Tags"
+        ]
+      ],
+      [
+        1,
+        "Rroonga is fast!",
+        1416150000.0,
+        "Rroonga"
+      ],
+      [
+        2,
+        "Mroonga is fast!",
+        1416063600.0,
+        "Mroonga"
+      ],
+      [
+        3,
+        "Groonga is fast!",
+        1416063600.0,
+        "Groonga"
+      ],
+      [
+        4,
+        "Groonga sticker!",
+        1416063600.0,
+        "Groonga"
+      ],
+      [
+        5,
+        "Groonga is good!",
+        1416150000.0,
+        "Groonga"
+      ]
+    ],
+    {
+      "tag": [
+        [
+          4
+        ],
+        [
+          [
+            "_key[0]",
+            null
+          ],
+          [
+            "_key[1]",
+            null
+          ],
+          [
+            "_nsubrecs",
+            "Int32"
+          ]
+        ],
+        [
+          "Groonga",
+          1416063600.0,
+          2
+        ],
+        [
+          "Groonga",
+          1416150000.0,
+          1
+        ],
+        [
+          "Mroonga",
+          1416063600.0,
+          1
+        ],
+        [
+          "Rroonga",
+          1416150000.0,
+          1
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/select/drilldown/labeled/sort_keys/sub_record_column/multiple.test (+21 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/labeled/sort_keys/sub_record_column/multiple.test    2016-05-20 09:41:56 +0900 (33149cd)
@@ -0,0 +1,21 @@
+table_create Tags TABLE_PAT_KEY ShortText
+
+table_create Memos TABLE_HASH_KEY ShortText
+column_create Memos tag COLUMN_SCALAR Tags
+column_create Memos date COLUMN_SCALAR Time
+
+load --table Memos
+[
+{"_key": "Rroonga is fast!", "tag": "Rroonga", "date": "2014-11-17 00:00:00"},
+{"_key": "Mroonga is fast!", "tag": "Mroonga", "date": "2014-11-16 00:00:00"},
+{"_key": "Groonga is fast!", "tag": "Groonga", "date": "2014-11-16 00:00:00"},
+{"_key": "Groonga sticker!", "tag": "Groonga", "date": "2014-11-16 00:00:00"},
+{"_key": "Groonga is good!", "tag": "Groonga", "date": "2014-11-17 00:00:00"}
+]
+
+select Memos \
+  --command_version 2 \
+  --filter true \
+  --drilldown[tag].keys tag,date \
+  --drilldown[tag].output_columns _key[0],_key[1],_nsubrecs \
+  --drilldown[tag].sort_keys _value.tag._key,_value.date

  Added: test/command/suite/select/drilldown/plain/sort_keys.expected (+61 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/plain/sort_keys.expected    2016-05-20 09:41:56 +0900 (a14956c)
@@ -0,0 +1,61 @@
+table_create Memos TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Memos tags COLUMN_VECTOR ShortText
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"_key": "Groonga is fast!", "tags": ["Groonga"]},
+{"_key": "Mroonga is fast!", "tags": ["Mroonga", "Groonga"]},
+{"_key": "Groonga sticker!", "tags": ["Groonga"]},
+{"_key": "Rroonga is fast!", "tags": ["Rroonga", "Groonga"]},
+{"_key": "Groonga is good!", "tags": ["Groonga"]}
+]
+[[0,0.0,0.0],5]
+select Memos   --limit 0   --output_columns _id   --drilldown tags   --drilldown_output_columns _key,_nsubrecs   --drilldown_sort_keys -_nsubrecs,_key
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        5
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ]
+      ]
+    ],
+    [
+      [
+        3
+      ],
+      [
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "_nsubrecs",
+          "Int32"
+        ]
+      ],
+      [
+        "Groonga",
+        5
+      ],
+      [
+        "Mroonga",
+        1
+      ],
+      [
+        "Rroonga",
+        1
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/drilldown/plain/sort_keys.test (+18 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/plain/sort_keys.test    2016-05-20 09:41:56 +0900 (f15788a)
@@ -0,0 +1,18 @@
+table_create Memos TABLE_HASH_KEY ShortText
+column_create Memos tags COLUMN_VECTOR ShortText
+
+load --table Memos
+[
+{"_key": "Groonga is fast!", "tags": ["Groonga"]},
+{"_key": "Mroonga is fast!", "tags": ["Mroonga", "Groonga"]},
+{"_key": "Groonga sticker!", "tags": ["Groonga"]},
+{"_key": "Rroonga is fast!", "tags": ["Rroonga", "Groonga"]},
+{"_key": "Groonga is good!", "tags": ["Groonga"]}
+]
+
+select Memos \
+  --limit 0 \
+  --output_columns _id \
+  --drilldown tags \
+  --drilldown_output_columns _key,_nsubrecs \
+  --drilldown_sort_keys -_nsubrecs,_key

  Added: test/command/suite/select/drilldown/plain/sortby.expected (+61 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/plain/sortby.expected    2016-05-20 09:41:56 +0900 (f0438d9)
@@ -0,0 +1,61 @@
+table_create Memos TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Memos tags COLUMN_VECTOR ShortText
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"_key": "Groonga is fast!", "tags": ["Groonga"]},
+{"_key": "Mroonga is fast!", "tags": ["Mroonga", "Groonga"]},
+{"_key": "Groonga sticker!", "tags": ["Groonga"]},
+{"_key": "Rroonga is fast!", "tags": ["Rroonga", "Groonga"]},
+{"_key": "Groonga is good!", "tags": ["Groonga"]}
+]
+[[0,0.0,0.0],5]
+select Memos   --limit 0   --output_columns _id   --drilldown tags   --drilldown_output_columns _key,_nsubrecs   --drilldown_sortby -_nsubrecs,_key
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        5
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ]
+      ]
+    ],
+    [
+      [
+        3
+      ],
+      [
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "_nsubrecs",
+          "Int32"
+        ]
+      ],
+      [
+        "Groonga",
+        5
+      ],
+      [
+        "Mroonga",
+        1
+      ],
+      [
+        "Rroonga",
+        1
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/drilldown/plain/sortby.test (+18 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/plain/sortby.test    2016-05-20 09:41:56 +0900 (4296f5a)
@@ -0,0 +1,18 @@
+table_create Memos TABLE_HASH_KEY ShortText
+column_create Memos tags COLUMN_VECTOR ShortText
+
+load --table Memos
+[
+{"_key": "Groonga is fast!", "tags": ["Groonga"]},
+{"_key": "Mroonga is fast!", "tags": ["Mroonga", "Groonga"]},
+{"_key": "Groonga sticker!", "tags": ["Groonga"]},
+{"_key": "Rroonga is fast!", "tags": ["Rroonga", "Groonga"]},
+{"_key": "Groonga is good!", "tags": ["Groonga"]}
+]
+
+select Memos \
+  --limit 0 \
+  --output_columns _id \
+  --drilldown tags \
+  --drilldown_output_columns _key,_nsubrecs \
+  --drilldown_sortby -_nsubrecs,_key

  Copied: test/command/suite/select/sort_keys/compressed.expected (+1 -1) 96%
===================================================================
--- test/command/suite/select/sort/compressed.expected    2016-05-20 09:21:55 +0900 (fe13707)
+++ test/command/suite/select/sort_keys/compressed.expected    2016-05-20 09:41:56 +0900 (6a9eda7)
@@ -9,7 +9,7 @@ load --table Users
 {"_key": "mori", "name": "森"}
 ]
 [[0,0.0,0.0],3]
-select Users --sortby name
+select Users --sort_keys name
 [
   [
     0,

  Copied: test/command/suite/select/sort_keys/compressed.test (+1 -1) 88%
===================================================================
--- test/command/suite/select/sort/compressed.test    2016-05-20 09:21:55 +0900 (52c5b3f)
+++ test/command/suite/select/sort_keys/compressed.test    2016-05-20 09:41:56 +0900 (dc4a162)
@@ -8,4 +8,4 @@ load --table Users
 {"_key": "mori", "name": "森"}
 ]
 
-select Users --sortby name
+select Users --sort_keys name

  Copied: test/command/suite/select/sort_keys/geo/distance/limit.expected (+1 -1) 83%
===================================================================
--- test/command/suite/select/sort/geo/distance/limit.expected    2016-05-20 09:21:55 +0900 (f7f02bb)
+++ test/command/suite/select/sort_keys/geo/distance/limit.expected    2016-05-20 09:41:56 +0900 (b073203)
@@ -1,4 +1,4 @@
-select LandMarks --sortby 'geo_distance(point, "0x0")' --limit 3
+select LandMarks --sort_keys 'geo_distance(point, "0x0")' --limit 3
 [
   [
     0,

  Added: test/command/suite/select/sort_keys/geo/distance/limit.test (+3 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/sort_keys/geo/distance/limit.test    2016-05-20 09:41:56 +0900 (7c1e1d2)
@@ -0,0 +1,3 @@
+#@include fixture/geo/sort/init.grn
+
+select LandMarks --sort_keys 'geo_distance(point, "0x0")' --limit 3

  Copied: test/command/suite/select/sort_keys/geo/distance/no_limit.expected (+1 -1) 90%
===================================================================
--- test/command/suite/select/sort/geo/distance/no_limit.expected    2016-05-20 09:21:55 +0900 (0b918ca)
+++ test/command/suite/select/sort_keys/geo/distance/no_limit.expected    2016-05-20 09:41:56 +0900 (b027ebc)
@@ -1,4 +1,4 @@
-select LandMarks --sortby 'geo_distance(point, "0x0")' --limit -1
+select LandMarks --sort_keys 'geo_distance(point, "0x0")' --limit -1
 [
   [
     0,

  Added: test/command/suite/select/sort_keys/geo/distance/no_limit.test (+3 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/sort_keys/geo/distance/no_limit.test    2016-05-20 09:41:56 +0900 (ce8b6db)
@@ -0,0 +1,3 @@
+#@include fixture/geo/sort/init.grn
+
+select LandMarks --sort_keys 'geo_distance(point, "0x0")' --limit -1

  Copied: test/command/suite/select/sort_keys/geo/distance/not_indexed.expected (+1 -1) 89%
===================================================================
--- test/command/suite/select/sort/geo/distance/not_indexed.expected    2016-05-20 09:21:55 +0900 (63a4505)
+++ test/command/suite/select/sort_keys/geo/distance/not_indexed.expected    2016-05-20 09:41:56 +0900 (8924b5c)
@@ -14,7 +14,7 @@ load --table Shops
 {"name":"たい焼 カタオカ", "location":null}
 ]
 [[0,0.0,0.0],2]
-select Shops   --sortby 'geo_distance(location, "35.67487x139.76352")'   --output_columns '_id, name, location'
+select Shops   --sort_keys 'geo_distance(location, "35.67487x139.76352")'   --output_columns '_id, name, location'
 [
   [
     0,

  Copied: test/command/suite/select/sort_keys/geo/distance/not_indexed.test (+1 -1) 88%
===================================================================
--- test/command/suite/select/sort/geo/distance/not_indexed.test    2016-05-20 09:21:55 +0900 (336c187)
+++ test/command/suite/select/sort_keys/geo/distance/not_indexed.test    2016-05-20 09:41:56 +0900 (dab06ff)
@@ -13,6 +13,6 @@ load --table Shops
 ]
 
 select Shops \
-  --sortby 'geo_distance(location, "35.67487x139.76352")' \
+  --sort_keys 'geo_distance(location, "35.67487x139.76352")' \
   --output_columns '_id, name, location'
 

  Copied: test/command/suite/select/sort_keys/geo/distance/offset_and_limit.expected (+1 -1) 81%
===================================================================
--- test/command/suite/select/sort/geo/distance/offset_and_limit.expected    2016-05-20 09:21:55 +0900 (b11e33e)
+++ test/command/suite/select/sort_keys/geo/distance/offset_and_limit.expected    2016-05-20 09:41:56 +0900 (37b11e7)
@@ -1,4 +1,4 @@
-select LandMarks --sortby 'geo_distance(point, "0x0")' --offset 2 --limit 3
+select LandMarks --sort_keys 'geo_distance(point, "0x0")' --offset 2 --limit 3
 [
   [
     0,

  Added: test/command/suite/select/sort_keys/geo/distance/offset_and_limit.test (+3 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/sort_keys/geo/distance/offset_and_limit.test    2016-05-20 09:41:56 +0900 (feb847b)
@@ -0,0 +1,3 @@
+#@include fixture/geo/sort/init.grn
+
+select LandMarks --sort_keys 'geo_distance(point, "0x0")' --offset 2 --limit 3

  Copied: test/command/suite/select/sort_keys/geo/distance/with_condition.expected (+1 -1) 73%
===================================================================
--- test/command/suite/select/sort/geo/distance/with_condition.expected    2016-05-20 09:21:55 +0900 (33e374c)
+++ test/command/suite/select/sort_keys/geo/distance/with_condition.expected    2016-05-20 09:41:56 +0900 (443ac58)
@@ -1,4 +1,4 @@
-select Shops   --sortby 'geo_distance(location, "35.67487x139.76352")'   --output_columns 'name, _score'   --filter 'geo_in_circle(location, "35.67487x139.76352", 3000)'   --scorer '_score=geo_distance(location, "35.67487x139.76352")'
+select Shops   --sort_keys 'geo_distance(location, "35.67487x139.76352")'   --output_columns 'name, _score'   --filter 'geo_in_circle(location, "35.67487x139.76352", 3000)'   --scorer '_score=geo_distance(location, "35.67487x139.76352")'
 [
   [
     0,

  Copied: test/command/suite/select/sort_keys/geo/distance/with_condition.test (+1 -1) 78%
===================================================================
--- test/command/suite/select/sort/geo/distance/with_condition.test    2016-05-20 09:21:55 +0900 (f060a3a)
+++ test/command/suite/select/sort_keys/geo/distance/with_condition.test    2016-05-20 09:41:56 +0900 (fe68d4c)
@@ -1,7 +1,7 @@
 #@include fixture/geo/taiyaki/init.grn
 
 select Shops \
-  --sortby 'geo_distance(location, "35.67487x139.76352")' \
+  --sort_keys 'geo_distance(location, "35.67487x139.76352")' \
   --output_columns 'name, _score' \
   --filter 'geo_in_circle(location, "35.67487x139.76352", 3000)' \
   --scorer '_score=geo_distance(location, "35.67487x139.76352")'

  Copied: test/command/suite/select/sort_keys/geo/distance/without_condition.expected (+1 -1) 86%
===================================================================
--- test/command/suite/select/sort/geo/distance/without_condition.expected    2016-05-20 09:21:55 +0900 (8694e50)
+++ test/command/suite/select/sort_keys/geo/distance/without_condition.expected    2016-05-20 09:41:56 +0900 (f6ba8aa)
@@ -1,4 +1,4 @@
-select Shops   --sortby 'geo_distance(location, "35.67487x139.76352")'   --output_columns 'name'
+select Shops   --sort_keys 'geo_distance(location, "35.67487x139.76352")'   --output_columns 'name'
 [
   [
     0,

  Copied: test/command/suite/select/sort_keys/geo/distance/without_condition.test (+1 -1) 56%
===================================================================
--- test/command/suite/select/sort/geo/distance/without_condition.test    2016-05-20 09:21:55 +0900 (5b708e1)
+++ test/command/suite/select/sort_keys/geo/distance/without_condition.test    2016-05-20 09:41:56 +0900 (e0473cd)
@@ -1,6 +1,6 @@
 #@include fixture/geo/taiyaki/init.grn
 
 select Shops \
-  --sortby 'geo_distance(location, "35.67487x139.76352")' \
+  --sort_keys 'geo_distance(location, "35.67487x139.76352")' \
   --output_columns 'name'
 

  Copied: test/command/suite/select/sort_keys/index.expected (+1 -1) 97%
===================================================================
--- test/command/suite/select/sort/index.expected    2016-05-20 09:21:55 +0900 (83f883f)
+++ test/command/suite/select/sort_keys/index.expected    2016-05-20 09:41:56 +0900 (636a1f4)
@@ -14,7 +14,7 @@ load --table Logs
 ["Error: invalid argument."]
 ]
 [[0,0.0,0.0],3]
-select Terms --sortby -index
+select Terms --sort_keys -index
 [
   [
     0,

  Copied: test/command/suite/select/sort_keys/index.test (+1 -1) 92%
===================================================================
--- test/command/suite/select/sort/index.test    2016-05-20 09:21:55 +0900 (3a08bda)
+++ test/command/suite/select/sort_keys/index.test    2016-05-20 09:41:56 +0900 (57e0f18)
@@ -14,4 +14,4 @@ load --table Logs
 ["Error: invalid argument."]
 ]
 
-select Terms --sortby -index
+select Terms --sort_keys -index

  Copied: test/command/suite/select/sort_keys/key/double_array_trie.expected (+1 -1) 93%
===================================================================
--- test/command/suite/select/sort/key/double_array_trie.expected    2016-05-20 09:21:55 +0900 (4f80e8e)
+++ test/command/suite/select/sort_keys/key/double_array_trie.expected    2016-05-20 09:41:56 +0900 (7569368)
@@ -7,7 +7,7 @@ load --table Numbers
 {"_key": -255}
 ]
 [[0,0.0,0.0],3]
-select Numbers --sortby _key
+select Numbers --sort_keys _key
 [
   [
     0,

  Copied: test/command/suite/select/sort_keys/key/double_array_trie.test (+1 -1) 77%
===================================================================
--- test/command/suite/select/sort/key/double_array_trie.test    2016-05-20 09:21:55 +0900 (ce060f4)
+++ test/command/suite/select/sort_keys/key/double_array_trie.test    2016-05-20 09:41:56 +0900 (4e7bcca)
@@ -7,4 +7,4 @@ load --table Numbers
 {"_key": -255}
 ]
 
-select Numbers --sortby _key
+select Numbers --sort_keys _key

  Copied: test/command/suite/select/sort_keys/key/hash_key.expected (+1 -1) 93%
===================================================================
--- test/command/suite/select/sort/key/hash_key.expected    2016-05-20 09:21:55 +0900 (6dccef6)
+++ test/command/suite/select/sort_keys/key/hash_key.expected    2016-05-20 09:41:56 +0900 (9cc16dc)
@@ -7,7 +7,7 @@ load --table Numbers
 {"_key": -255}
 ]
 [[0,0.0,0.0],3]
-select Numbers --sortby _key
+select Numbers --sort_keys _key
 [
   [
     0,

  Copied: test/command/suite/select/sort_keys/key/hash_key.test (+1 -1) 78%
===================================================================
--- test/command/suite/select/sort/key/hash_key.test    2016-05-20 09:21:55 +0900 (d75e120)
+++ test/command/suite/select/sort_keys/key/hash_key.test    2016-05-20 09:41:56 +0900 (49e0d81)
@@ -7,4 +7,4 @@ load --table Numbers
 {"_key": -255}
 ]
 
-select Numbers --sortby _key
+select Numbers --sort_keys _key

  Copied: test/command/suite/select/sort_keys/key/patricia_trie.expected (+1 -1) 93%
===================================================================
--- test/command/suite/select/sort/key/patricia_trie.expected    2016-05-20 09:21:55 +0900 (e0cf7a4)
+++ test/command/suite/select/sort_keys/key/patricia_trie.expected    2016-05-20 09:41:56 +0900 (55fac44)
@@ -7,7 +7,7 @@ load --table Numbers
 {"_key": -255}
 ]
 [[0,0.0,0.0],3]
-select Numbers --sortby _key
+select Numbers --sort_keys _key
 [
   [
     0,

  Copied: test/command/suite/select/sort_keys/key/patricia_trie.test (+1 -1) 77%
===================================================================
--- test/command/suite/select/sort/key/patricia_trie.test    2016-05-20 09:21:55 +0900 (c62d1d4)
+++ test/command/suite/select/sort_keys/key/patricia_trie.test    2016-05-20 09:41:56 +0900 (d1e0c30)
@@ -7,4 +7,4 @@ load --table Numbers
 {"_key": -255}
 ]
 
-select Numbers --sortby _key
+select Numbers --sort_keys _key

  Copied: test/command/suite/select/sort_keys/string_use_8bit.expected (+1 -1) 96%
===================================================================
--- test/command/suite/select/sort/string_use_8bit.expected    2016-05-20 09:21:55 +0900 (358ad4e)
+++ test/command/suite/select/sort_keys/string_use_8bit.expected    2016-05-20 09:41:56 +0900 (a92d6f2)
@@ -9,7 +9,7 @@ load --table Users
 {"_key": "mori", "name": "森"}
 ]
 [[0,0.0,0.0],3]
-select Users --sortby name
+select Users --sort_keys name
 [
   [
     0,

  Copied: test/command/suite/select/sort_keys/string_use_8bit.test (+1 -1) 87%
===================================================================
--- test/command/suite/select/sort/string_use_8bit.test    2016-05-20 09:21:55 +0900 (f994231)
+++ test/command/suite/select/sort_keys/string_use_8bit.test    2016-05-20 09:41:56 +0900 (d385801)
@@ -8,4 +8,4 @@ load --table Users
 {"_key": "mori", "name": "森"}
 ]
 
-select Users --sortby name
+select Users --sort_keys name

  Renamed: test/command/suite/select/sortby/compressed.expected (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/compressed.test (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/geo/distance/limit.expected (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/geo/distance/limit.test (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/geo/distance/no_limit.expected (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/geo/distance/no_limit.test (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/geo/distance/not_indexed.expected (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/geo/distance/not_indexed.test (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/geo/distance/offset_and_limit.expected (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/geo/distance/offset_and_limit.test (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/geo/distance/with_condition.expected (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/geo/distance/with_condition.test (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/geo/distance/without_condition.expected (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/geo/distance/without_condition.test (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/index.expected (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/index.test (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/key/double_array_trie.expected (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/key/double_array_trie.test (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/key/hash_key.expected (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/key/hash_key.test (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/key/patricia_trie.expected (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/key/patricia_trie.test (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/string_use_8bit.expected (+0 -0) 100%
===================================================================

  Renamed: test/command/suite/select/sortby/string_use_8bit.test (+0 -0) 100%
===================================================================
-------------- next part --------------
HTML����������������������������...
Télécharger 



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