[Groonga-commit] groonga/groonga at 4e2fc2b [master] doc select logical_select: add dynamic columns for drilldown

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Mar 29 16:44:39 JST 2017


Kouhei Sutou	2017-03-29 16:44:39 +0900 (Wed, 29 Mar 2017)

  New Revision: 4e2fc2bdb3a927e41616413ce2a448b5f555ad6e
  https://github.com/groonga/groonga/commit/4e2fc2bdb3a927e41616413ce2a448b5f555ad6e

  Message:
    doc select logical_select: add dynamic columns for drilldown

  Added files:
    doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_flags.log
    doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_stage.log
    doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_type.log
    doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_value.log
    doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_window_group_keys.log
    doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_window_sort_keys.log
  Modified files:
    doc/source/example/reference/commands/logical_select/logical_table_nonexistent.log
    doc/source/reference/commands/logical_select.rst
    doc/source/reference/commands/select.rst

  Added: doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_flags.log (+74 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_flags.log    2017-03-29 16:44:39 +0900 (2a46c0e)
@@ -0,0 +1,74 @@
+Execution example::
+
+  logical_select \
+    --logical_table Entries \
+    --shard_key created_at \
+    --limit 0 \
+    --output_columns _id \
+    --drilldowns[tag].keys tag \
+    --drilldowns[tag].columns[vector].stage initial \
+    --drilldowns[tag].columns[vector].flags COLUMN_VECTOR \
+    --drilldowns[tag].columns[vector].type ShortText \
+    --drilldowns[tag].columns[vector].value 'vector_new("a", "b", "c")' \
+    --drilldowns[tag].output_columns _key,vector
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         5
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ]
+  #       ]
+  #     ], 
+  #     {
+  #       "tag": [
+  #         [
+  #           3
+  #         ], 
+  #         [
+  #           [
+  #             "_key", 
+  #             "ShortText"
+  #           ], 
+  #           [
+  #             "vector", 
+  #             "ShortText"
+  #           ]
+  #         ], 
+  #         [
+  #           "Hello", 
+  #           [
+  #             "a", 
+  #             "b", 
+  #             "c"
+  #           ]
+  #         ], 
+  #         [
+  #           "Groonga", 
+  #           [
+  #             "a", 
+  #             "b", 
+  #             "c"
+  #           ]
+  #         ], 
+  #         [
+  #           "Senna", 
+  #           [
+  #             "a", 
+  #             "b", 
+  #             "c"
+  #           ]
+  #         ]
+  #       ]
+  #     }
+  #   ]
+  # ]

  Added: doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_stage.log (+68 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_stage.log    2017-03-29 16:44:39 +0900 (93fb1c6)
@@ -0,0 +1,68 @@
+Execution example::
+
+  logical_select \
+    --logical_table Entries \
+    --shard_key created_at \
+    --limit 0 \
+    --output_columns _id \
+    --drilldowns[tag].keys tag \
+    --drilldowns[tag].columns[is_popular].stage initial \
+    --drilldowns[tag].columns[is_popular].type Bool \
+    --drilldowns[tag].columns[is_popular].value '_nsubrecs > 1' \
+    --drilldowns[tag].output_columns _key,_nsubrecs,is_popular
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         5
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ]
+  #       ]
+  #     ], 
+  #     {
+  #       "tag": [
+  #         [
+  #           3
+  #         ], 
+  #         [
+  #           [
+  #             "_key", 
+  #             "ShortText"
+  #           ], 
+  #           [
+  #             "_nsubrecs", 
+  #             "Int32"
+  #           ], 
+  #           [
+  #             "is_popular", 
+  #             "Bool"
+  #           ]
+  #         ], 
+  #         [
+  #           "Hello", 
+  #           1, 
+  #           false
+  #         ], 
+  #         [
+  #           "Groonga", 
+  #           2, 
+  #           true
+  #         ], 
+  #         [
+  #           "Senna", 
+  #           2, 
+  #           true
+  #         ]
+  #       ]
+  #     }
+  #   ]
+  # ]

  Added: doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_type.log (+68 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_type.log    2017-03-29 16:44:39 +0900 (0e09f00)
@@ -0,0 +1,68 @@
+Execution example::
+
+  logical_select \
+    --logical_table Entries \
+    --shard_key created_at \
+    --limit 0 \
+    --output_columns _id \
+    --drilldowns[tag].keys tag \
+    --drilldowns[tag].columns[nsubrecs_string].stage initial \
+    --drilldowns[tag].columns[nsubrecs_string].type ShortText \
+    --drilldowns[tag].columns[nsubrecs_string].value _nsubrecs \
+    --drilldowns[tag].output_columns _key,_nsubrecs,nsubrecs_string
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         5
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ]
+  #       ]
+  #     ], 
+  #     {
+  #       "tag": [
+  #         [
+  #           3
+  #         ], 
+  #         [
+  #           [
+  #             "_key", 
+  #             "ShortText"
+  #           ], 
+  #           [
+  #             "_nsubrecs", 
+  #             "Int32"
+  #           ], 
+  #           [
+  #             "nsubrecs_string", 
+  #             "ShortText"
+  #           ]
+  #         ], 
+  #         [
+  #           "Hello", 
+  #           1, 
+  #           "1"
+  #         ], 
+  #         [
+  #           "Groonga", 
+  #           2, 
+  #           "2"
+  #         ], 
+  #         [
+  #           "Senna", 
+  #           2, 
+  #           "2"
+  #         ]
+  #       ]
+  #     }
+  #   ]
+  # ]

  Added: doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_value.log (+14 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_value.log    2017-03-29 16:44:39 +0900 (2ac5afd)
@@ -0,0 +1,14 @@
+Execution example::
+
+  plugin_register functions/string \
+  logical_select \
+    --logical_table Entries \
+    --shard_key created_at \
+    --limit 0 \
+    --output_columns _id \
+    --drilldowns[tag].keys tag \
+    --drilldowns[tag].columns[tag_length].stage initial \
+    --drilldowns[tag].columns[tag_length].type UInt32 \
+    --drilldowns[tag].columns[tag_length].value 'string_length(_key)' \
+    --drilldowns[tag].output_columns _key,tag_length
+  # [[0, 1337566253.89858, 0.000355720520019531], true]

  Added: doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_window_group_keys.log (+71 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_window_group_keys.log    2017-03-29 16:44:39 +0900 (67edb7c)
@@ -0,0 +1,71 @@
+Execution example::
+
+  logical_select \
+    --logical_table Entries \
+    --shard_key created_at \
+    --limit 0 \
+    --output_columns _id \
+    --drilldowns[tag].keys tag \
+    --drilldowns[tag].columns[record_number].stage initial \
+    --drilldowns[tag].columns[record_number].type UInt32 \
+    --drilldowns[tag].columns[record_number].value 'window_record_number()' \
+    --drilldowns[tag].columns[record_number].window.sort_keys _key \
+    --drilldowns[tag].columns[record_number].window.group_keys _nsubrecs \
+    --drilldowns[tag].sort_keys _nsubrecs,record_number \
+    --drilldowns[tag].output_columns _key,_nsubrecs,record_number
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         5
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ]
+  #       ]
+  #     ], 
+  #     {
+  #       "tag": [
+  #         [
+  #           3
+  #         ], 
+  #         [
+  #           [
+  #             "_key", 
+  #             "ShortText"
+  #           ], 
+  #           [
+  #             "_nsubrecs", 
+  #             "Int32"
+  #           ], 
+  #           [
+  #             "record_number", 
+  #             "UInt32"
+  #           ]
+  #         ], 
+  #         [
+  #           "Hello", 
+  #           1, 
+  #           1
+  #         ], 
+  #         [
+  #           "Groonga", 
+  #           2, 
+  #           1
+  #         ], 
+  #         [
+  #           "Senna", 
+  #           2, 
+  #           2
+  #         ]
+  #       ]
+  #     }
+  #   ]
+  # ]

  Added: doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_window_sort_keys.log (+70 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/commands/logical_select/drilldowns_label_columns_name_window_sort_keys.log    2017-03-29 16:44:39 +0900 (76d0cde)
@@ -0,0 +1,70 @@
+Execution example::
+
+  logical_select \
+    --logical_table Entries \
+    --shard_key created_at \
+    --limit 0 \
+    --output_columns _id \
+    --drilldowns[tag].keys tag \
+    --drilldowns[tag].columns[record_number].stage initial \
+    --drilldowns[tag].columns[record_number].type UInt32 \
+    --drilldowns[tag].columns[record_number].value 'window_record_number()' \
+    --drilldowns[tag].columns[record_number].window.sort_keys _nsubrecs,_key \
+    --drilldowns[tag].sort_keys record_number \
+    --drilldowns[tag].output_columns _key,_nsubrecs,record_number
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         5
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ]
+  #       ]
+  #     ], 
+  #     {
+  #       "tag": [
+  #         [
+  #           3
+  #         ], 
+  #         [
+  #           [
+  #             "_key", 
+  #             "ShortText"
+  #           ], 
+  #           [
+  #             "_nsubrecs", 
+  #             "Int32"
+  #           ], 
+  #           [
+  #             "record_number", 
+  #             "UInt32"
+  #           ]
+  #         ], 
+  #         [
+  #           "Hello", 
+  #           1, 
+  #           1
+  #         ], 
+  #         [
+  #           "Groonga", 
+  #           2, 
+  #           2
+  #         ], 
+  #         [
+  #           "Senna", 
+  #           2, 
+  #           3
+  #         ]
+  #       ]
+  #     }
+  #   ]
+  # ]

  Modified: doc/source/example/reference/commands/logical_select/logical_table_nonexistent.log (+1 -1)
===================================================================
--- doc/source/example/reference/commands/logical_select/logical_table_nonexistent.log    2017-03-29 16:42:38 +0900 (9a6e729)
+++ doc/source/example/reference/commands/logical_select/logical_table_nonexistent.log    2017-03-29 16:44:39 +0900 (487a876)
@@ -11,7 +11,7 @@ Execution example::
   #       [
   #         "Groonga::Sharding::LogicalSelectCommand::Executor.execute_search", 
   #         "/home/kou/work/c/groonga.clean/plugins/sharding/logical_select.rb", 
-  #         722
+  #         726
   #       ]
   #     ]
   #   ]

  Modified: doc/source/reference/commands/logical_select.rst (+202 -14)
===================================================================
--- doc/source/reference/commands/logical_select.rst    2017-03-29 16:42:38 +0900 (9bb7ff5)
+++ doc/source/reference/commands/logical_select.rst    2017-03-29 16:44:39 +0900 (51b5e40)
@@ -448,7 +448,7 @@ Here is an example to find records that include ``"fast"`` text in
 .. versionadded:: 7.0.1
 
 Corresponds to :ref:`select-query` in :doc:`select`. See
-:ref:`select-query-columns` for details.
+:ref:`select-query` for details.
 
 Here is an example to find records that include ``"fast"`` text in
 ``content`` column:
@@ -625,9 +625,9 @@ Corresponds to :ref:`select-columns-name-stage` in :doc:`select`. See
 
 This is a required parameter.
 
-Here is a ``columns[${NAME}].stage`` example. It creates
-``is_popular`` column at ``initial`` stage. You can use ``is_popular``
-in all parameters such as ``filter`` and ``output_columns``:
+Here is an example that creates ``is_popular`` column at ``initial``
+stage. You can use ``is_popular`` in all parameters such as ``filter``
+and ``output_columns``:
 
 .. groonga-command
 .. include:: ../../example/reference/commands/logical_select/columns_name_stage.log
@@ -652,10 +652,9 @@ Corresponds to :ref:`select-columns-name-flags` in :doc:`select`. See
 
 The default value is ``COLUMN_SCALAR``.
 
-Here is a ``columns[${NAME}].flags`` example. It creates a vector
-column by ``COLUMN_VECTOR`` flags. ``plugin_register
-functions/vector`` is for using :doc:`/reference/functions/vector_new`
-function:
+Here is an example that creates a vector column by ``COLUMN_VECTOR``
+flags. ``plugin_register functions/vector`` is for using
+:doc:`/reference/functions/vector_new` function:
 
 .. groonga-command
 .. include:: ../../example/reference/commands/logical_select/columns_name_flags.log
@@ -681,9 +680,9 @@ Corresponds to :ref:`select-columns-name-type` in :doc:`select`. See
 
 This is a required parameter.
 
-Here is a ``columns[${NAME}].type`` example. It creates a
-``ShortText`` type column. Stored value is casted to ``ShortText``
-automatically. In this example, number is casted to ``ShortText``:
+Here is an example that creates a ``ShortText`` type column. Stored
+value is casted to ``ShortText`` automatically. In this example,
+number is casted to ``ShortText``:
 
 .. groonga-command
 .. include:: ../../example/reference/commands/logical_select/columns_name_type.log
@@ -712,9 +711,9 @@ for details.
 
 This is a required parameter.
 
-Here is a ``columns[${NAME}].value`` example. It creates a new dynamic
-column that stores the number of characters of content. This example
-uses :doc:`/reference/functions/string_length` function in
+Here is an example that creates a new dynamic column that stores the
+number of characters of content. This example uses
+:doc:`/reference/functions/string_length` function in
 ``functions/string`` plugin to compute the number of characters in a
 string. :doc:`plugin_register` is used to register
 ``functions/string`` plugin:
@@ -1167,6 +1166,195 @@ only once:
 ..   --drilldowns[tag].tiler "_nsubrecs > 1" \
 ..   --drilldowns[tag].output_columns _key,_nsubrecs
 
+.. _logical-select-drilldowns-label-columns-name-stage:
+
+``drilldowns[${LABEL}].columns[${NAME}].stage``
+"""""""""""""""""""""""""""""""""""""""""""""""
+
+.. versionadded:: 7.0.1
+
+Corresponds to :ref:`select-drilldowns-label-columns-name-stage` in
+:doc:`select`. See :ref:`select-drilldowns-label-columns-name-stage`
+for details.
+
+Here is an example to create a dynamic column at ``initial``
+stage. This example creates a dynamic column whether each drilled down
+tag is occurred only once or not:
+
+.. groonga-command
+.. include:: ../../example/reference/commands/logical_select/drilldowns_label_columns_name_stage.log
+.. logical_select \
+..   --logical_table Entries \
+..   --shard_key created_at \
+..   --limit 0 \
+..   --output_columns _id \
+..   --drilldowns[tag].keys tag \
+..   --drilldowns[tag].columns[is_popular].stage initial \
+..   --drilldowns[tag].columns[is_popular].type Bool \
+..   --drilldowns[tag].columns[is_popular].value '_nsubrecs > 1' \
+..   --drilldowns[tag].output_columns _key,_nsubrecs,is_popular
+
+.. _logical-select-drilldowns-label-columns-name-flags:
+
+``drilldowns[${LABEL}].columns[${NAME}].flags``
+"""""""""""""""""""""""""""""""""""""""""""""""
+
+.. versionadded:: 7.0.1
+
+Corresponds to :ref:`logical-select-columns-name-flags` in main
+search.
+
+The default value is ``COLUMN_SCALAR``.
+
+Here is an example to create a vector column by ``COLUMN_VECTOR``
+flags. ``plugin_register functions/vector`` is for using
+:doc:`/reference/functions/vector_new` function:
+
+.. groonga-command
+.. include:: ../../example/reference/commands/logical_select/drilldowns_label_columns_name_flags.log
+.. logical_select \
+..   --logical_table Entries \
+..   --shard_key created_at \
+..   --limit 0 \
+..   --output_columns _id \
+..   --drilldowns[tag].keys tag \
+..   --drilldowns[tag].columns[vector].stage initial \
+..   --drilldowns[tag].columns[vector].flags COLUMN_VECTOR \
+..   --drilldowns[tag].columns[vector].type ShortText \
+..   --drilldowns[tag].columns[vector].value 'vector_new("a", "b", "c")' \
+..   --drilldowns[tag].output_columns _key,vector
+
+.. _logical-select-drilldowns-label-columns-name-type:
+
+``drilldowns[${LABEL}].columns[${NAME}].type``
+""""""""""""""""""""""""""""""""""""""""""""""
+
+.. versionadded:: 7.0.1
+
+Corresponds to :ref:`logical-select-columns-name-type` in main
+search.
+
+This is a required parameter.
+
+Here is an example to create a ``ShortText`` type column. Stored value
+is casted to ``ShortText`` automatically. In this example, number is
+casted to ``ShortText``:
+
+.. groonga-command
+.. include:: ../../example/reference/commands/logical_select/drilldowns_label_columns_name_type.log
+.. logical_select \
+..   --logical_table Entries \
+..   --shard_key created_at \
+..   --limit 0 \
+..   --output_columns _id \
+..   --drilldowns[tag].keys tag \
+..   --drilldowns[tag].columns[nsubrecs_string].stage initial \
+..   --drilldowns[tag].columns[nsubrecs_string].type ShortText \
+..   --drilldowns[tag].columns[nsubrecs_string].value _nsubrecs \
+..   --drilldowns[tag].output_columns _key,_nsubrecs,nsubrecs_string
+
+.. _logical-select-drilldowns-label-columns-name-value:
+
+``drilldowns[${LABEL}].columns[${NAME}].value``
+"""""""""""""""""""""""""""""""""""""""""""""""
+
+.. versionadded:: 7.0.1
+
+Corresponds to :ref:`logical-select-columns-name-value` in main
+search.
+
+This is a required parameter.
+
+Here is an example that creates a new dynamic column that stores the
+number of characters of content. This example uses
+:doc:`/reference/functions/string_length` function in
+``functions/string`` plugin to compute the number of characters in a
+string. :doc:`plugin_register` is used to register
+``functions/string`` plugin:
+
+.. groonga-command
+.. include:: ../../example/reference/commands/logical_select/drilldowns_label_columns_name_value.log
+.. plugin_register functions/string \
+.. logical_select \
+..   --logical_table Entries \
+..   --shard_key created_at \
+..   --limit 0 \
+..   --output_columns _id \
+..   --drilldowns[tag].keys tag \
+..   --drilldowns[tag].columns[tag_length].stage initial \
+..   --drilldowns[tag].columns[tag_length].type UInt32 \
+..   --drilldowns[tag].columns[tag_length].value 'string_length(_key)' \
+..   --drilldowns[tag].output_columns _key,tag_length
+
+.. _logical-select-drilldowns-label-columns-name-window-sort-keys:
+
+``drilldowns[${LABEL}].columns[${NAME}].window.sort_keys``
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+.. versionadded:: 7.0.1
+
+Corresponds to :ref:`logical-select-columns-name-window-sort-keys` in
+main search.
+
+You must specify
+:ref:`logical-select-drilldowns-label-columns-name-window-sort-keys`
+or
+:ref:`logical-select-drilldowns-label-columns-name-window-group-keys`
+to use window function.
+
+Here is an example that computes the Nth record in the number of sub
+records order:
+
+.. groonga-command
+.. include:: ../../example/reference/commands/logical_select/drilldowns_label_columns_name_window_sort_keys.log
+.. logical_select \
+..   --logical_table Entries \
+..   --shard_key created_at \
+..   --limit 0 \
+..   --output_columns _id \
+..   --drilldowns[tag].keys tag \
+..   --drilldowns[tag].columns[record_number].stage initial \
+..   --drilldowns[tag].columns[record_number].type UInt32 \
+..   --drilldowns[tag].columns[record_number].value 'window_record_number()' \
+..   --drilldowns[tag].columns[record_number].window.sort_keys _nsubrecs,_key \
+..   --drilldowns[tag].sort_keys record_number \
+..   --drilldowns[tag].output_columns _key,_nsubrecs,record_number
+
+.. _logical-select-drilldowns-label-columns-name-window-group-keys:
+
+``drilldowns[${LABEL}].columns[${NAME}].window.group_keys``
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+.. versionadded:: 7.0.1
+
+Corresponds to :ref:`logical-select-columns-name-window-group-keys` in
+main search.
+
+You must specify
+:ref:`logical-select-drilldowns-label-columns-name-window-sort-keys`
+or
+:ref:`logical-select-drilldowns-label-columns-name-window-group-keys`
+to use window function.
+
+Here is an example that computes the Nth record ordered by tag name
+for each the same number of sub records:
+
+.. groonga-command
+.. include:: ../../example/reference/commands/logical_select/drilldowns_label_columns_name_window_group_keys.log
+.. logical_select \
+..   --logical_table Entries \
+..   --shard_key created_at \
+..   --limit 0 \
+..   --output_columns _id \
+..   --drilldowns[tag].keys tag \
+..   --drilldowns[tag].columns[record_number].stage initial \
+..   --drilldowns[tag].columns[record_number].type UInt32 \
+..   --drilldowns[tag].columns[record_number].value 'window_record_number()' \
+..   --drilldowns[tag].columns[record_number].window.sort_keys _key \
+..   --drilldowns[tag].columns[record_number].window.group_keys _nsubrecs \
+..   --drilldowns[tag].sort_keys _nsubrecs,record_number \
+..   --drilldowns[tag].output_columns _key,_nsubrecs,record_number
+
 Return value
 ------------
 

  Modified: doc/source/reference/commands/select.rst (+96 -9)
===================================================================
--- doc/source/reference/commands/select.rst    2017-03-29 16:42:38 +0900 (7ab06dc)
+++ doc/source/reference/commands/select.rst    2017-03-29 16:44:39 +0900 (ca52c49)
@@ -1206,9 +1206,9 @@ points. You should choose stage as late as possible:
      columns created in ``initial`` stage, ``filtered`` stage and
      ``output`` stage.
 
-Here is a ``columns[${NAME}].stage`` example. It creates
-``is_popular`` column at ``initial`` stage. You can use ``is_popular``
-in all parameters such as ``filter`` and ``output_columns``:
+Here is an example that creates ``is_popular`` column at ``initial``
+stage. You can use ``is_popular`` in all parameters such as ``filter``
+and ``output_columns``:
 
 .. groonga-command
 .. include:: ../../example/reference/commands/select/columns_name_stage.log
@@ -1260,9 +1260,9 @@ available types.
 
 This is a required parameter.
 
-Here is a ``columns[${NAME}].type`` example. It creates a
-``ShortText`` type column. Stored value is casted to ``ShortText``
-automatically. In this example, number is casted to ``ShortText``:
+Here is an example that creates a ``ShortText`` type column. Stored
+value is casted to ``ShortText`` automatically. In this example,
+number is casted to ``ShortText``:
 
 .. groonga-command
 .. include:: ../../example/reference/commands/select/columns_name_type.log
@@ -1292,9 +1292,9 @@ details.
 
 This is a required parameter.
 
-Here is a ``columns[${NAME}].value`` example. It creates a new dynamic
-column that stores the number of characters of content. This example
-uses :doc:`/reference/functions/string_length` function in
+Here is an example that creates a new dynamic column that stores the
+number of characters of content. This example uses
+:doc:`/reference/functions/string_length` function in
 ``functions/string`` plugin to compute the number of characters in a
 string. :doc:`plugin_register` is used to register
 ``functions/string`` plugin:
@@ -2038,6 +2038,12 @@ parameters:
   * ``drilldowns[${LABEL}].calc_types``
   * ``drilldowns[${LABEL}].calc_target``
   * ``drilldowns[${LABEL}].filter``
+  * ``drilldowns[${LABEL}].columns[${NAME}].stage=null``
+  * ``drilldowns[${LABEL}].columns[${NAME}].flags=COLUMN_SCALAR``
+  * ``drilldowns[${LABEL}].columns[${NAME}].type=null``
+  * ``drilldowns[${LABEL}].columns[${NAME}].value=null``
+  * ``drilldowns[${LABEL}].columns[${NAME}].window.sort_keys=null``
+  * ``drilldowns[${LABEL}].columns[${NAME}].window.group_keys=null``
 
 ``${LABEL}`` is a variable. You can use the following characters for
 ``${LABEL}``:
@@ -2047,6 +2053,13 @@ parameters:
   * ``.``
   * ``_``
 
+``${NAME}`` is a variable. You can use the following characters for
+``${NAME}``:
+
+  * Alphabets
+  * Digits
+  * ``_``
+
 .. note::
 
    You can use more characters but it's better that you use only these
@@ -2082,10 +2095,25 @@ to use it for the following parameters:
   * ``drilldowns[${LABEL}].calc_target``: :ref:`select-drilldown-calc-target`
   * ``drilldowns[${LABEL}].filter``: :ref:`select-drilldown-filter`
 
+See document for corresponding ``columns[${NAME}].XXX`` parameter to
+know how to use it for the following parameters:
+
+  * ``drilldowns[${LABEL}].columns[${NAME}].flags=COLUMN_SCALAR``:
+    :ref:`select-columns-name-flags`
+  * ``drilldowns[${LABEL}].columns[${NAME}].type=null``:
+    :ref:`select-columns-name-type`
+  * ``drilldowns[${LABEL}].columns[${NAME}].value=null``:
+    :ref:`select-columns-name-value`
+  * ``drilldowns[${LABEL}].columns[${NAME}].window.sort_keys=null``:
+    :ref:`select-columns-name-window-sort-keys`
+  * ``drilldowns[${LABEL}].columns[${NAME}].window.group_keys=null``:
+    :ref:`select-columns-name-window-group-keys`
+
 The following parameters are needed more description:
 
   * ``drilldowns[${LABEL}].keys``
   * ``drilldowns[${LABEL}].output_columns``
+  * ``drilldowns[${LABEL}].columns[${NAME}].stage=null``
 
 Output format is different a bit. It's also needed more description.
 
@@ -2189,6 +2217,65 @@ Here is an example to refer each group key in multiple group keys by
    :ref:`select-drilldowns-label-keys`. So you can't refer group key by
    ``_value.${KEY_NAME}`` syntax.
 
+.. _select-drilldowns-label-columns-name-stage:
+
+``drilldowns[${LABEL}].columns[${NAME}].stage``
+"""""""""""""""""""""""""""""""""""""""""""""""
+
+.. versionadded:: 6.0.5
+
+Specifies when the dynamic column is created. This is a required
+parameter to create a dynamic column.
+
+Here are available stages:
+
+.. list-table::
+   :header-rows: 1
+
+   * - Name
+     - Description
+   * - ``initial``
+     - Dynamic column is created at first.
+
+Here is one drilldown process flow with dynamic column creation
+points. You should choose stage as late as possible:
+
+  #. Evaluates :ref:`select-drilldowns-label-keys`,
+     ``drilldowns[${LABEL}].calc_types`` and
+     ``drilldowns[${LABEL}].calc_target``.
+
+  #. Creates dynamic columns for ``initial`` stage. All drilldown
+     result records have these dynamic columns.
+
+  #. Evaluates ``drilldowns[${LABEL}].filter``. You can use dynamic
+     columns created in ``initial`` stage.
+
+  #. Evaluates ``drilldowns[${LABEL}].sort_keys``,
+     ``drilldowns[${LABEL}].offset`` and
+     ``drilldowns[${LABEL}].limit``. You can use dynamic columns
+     created in ``initial`` stage.
+
+  #. Evaluates :ref:`select-drilldowns-label-output-columns`. You can
+     use dynamic columns created in ``initial`` stage.
+
+Here is a ``drilldowns[${LABEL}].columns[${NAME}].stage`` example. It
+creates ``is_popular`` column at ``initial`` stage. You can use
+``is_popular`` in all parameters such as
+``drilldowns[${LABEL}].filter`` and
+``drilldowns[${LABEL}].output_columns``:
+
+.. groonga-command
+.. include:: ../../example/reference/commands/select/drilldowns_label_columns_name_stage.log
+.. select Entries \
+..   --drilldowns[tag].keys tag \
+..   --drilldowns[tag].columns[is_popular].stage initial \
+..   --drilldowns[tag].columns[is_popular].type Bool \
+..   --drilldowns[tag].columns[is_popular].value '_nsubrecs > 1' \
+..   --drilldowns[tag].filter is_popular \
+..   --drilldowns[tag].output_columns _key,is_popular,_nsubrecs
+
+.. versionadded:: 4.0.8
+
 .. _select-drilldowns-label-output-format:
 
 Output format for ``drilldowns[${LABEL}]`` style
-------------- next part --------------
HTML����������������������������...
Download 



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