Kouhei Sutou
null+****@clear*****
Thu Jun 28 12:51:11 JST 2018
Kouhei Sutou 2018-06-28 12:51:11 +0900 (Thu, 28 Jun 2018) New Revision: b33ea83769800f1cd14facd327b1959627b4aa7f https://github.com/groonga/groonga/commit/b33ea83769800f1cd14facd327b1959627b4aa7f Message: vector_find: operator -> mode for consistency Modified files: doc/files.am doc/locale/ja/LC_MESSAGES/reference.po doc/source/reference/functions/in_records.rst doc/source/reference/functions/query.rst doc/source/reference/functions/vector_find.rst plugins/functions/vector.c Renamed files: doc/source/example/reference/functions/vector_find/usage_find_mode.log (from doc/source/example/reference/functions/vector_find/usage_find_operator.log) Modified: doc/files.am (+2 -2) =================================================================== --- doc/files.am 2018-06-28 12:32:20 +0900 (e7e2f4673) +++ doc/files.am 2018-06-28 12:51:11 +0900 (0b66c8286) @@ -429,7 +429,7 @@ absolute_source_files = \ $(top_srcdir)/doc/source/example/reference/functions/sub_filter/usage_with_sub_filter.log \ $(top_srcdir)/doc/source/example/reference/functions/sub_filter/usage_without_sub_filter.log \ $(top_srcdir)/doc/source/example/reference/functions/vector_find/usage_find.log \ - $(top_srcdir)/doc/source/example/reference/functions/vector_find/usage_find_operator.log \ + $(top_srcdir)/doc/source/example/reference/functions/vector_find/usage_find_mode.log \ $(top_srcdir)/doc/source/example/reference/functions/vector_find/usage_register.log \ $(top_srcdir)/doc/source/example/reference/functions/vector_find/usage_setup_data.log \ $(top_srcdir)/doc/source/example/reference/functions/vector_find/usage_setup_schema.log \ @@ -1402,7 +1402,7 @@ source_files_relative_from_doc_dir = \ source/example/reference/functions/sub_filter/usage_with_sub_filter.log \ source/example/reference/functions/sub_filter/usage_without_sub_filter.log \ source/example/reference/functions/vector_find/usage_find.log \ - source/example/reference/functions/vector_find/usage_find_operator.log \ + source/example/reference/functions/vector_find/usage_find_mode.log \ source/example/reference/functions/vector_find/usage_register.log \ source/example/reference/functions/vector_find/usage_setup_data.log \ source/example/reference/functions/vector_find/usage_setup_schema.log \ Modified: doc/locale/ja/LC_MESSAGES/reference.po (+44 -43) =================================================================== --- doc/locale/ja/LC_MESSAGES/reference.po 2018-06-28 12:32:20 +0900 (0f4c8c7d1) +++ doc/locale/ja/LC_MESSAGES/reference.po 2018-06-28 12:51:11 +0900 (f7f339760) @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 1.2.1\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2018-06-28 12:32+0900\n" +"PO-Revision-Date: 2018-06-28 12:46+0900\n" "Last-Translator: Masafumi Yokoyama <yokoyama �� clear-code.com>\n" "Language-Team: Japanese\n" "Language: ja\n" @@ -20171,10 +20171,11 @@ msgstr "" msgid "" "See :ref:`query-default-mode` for available mode names. All mode names " -"except ``NEAR``, ``SIMILAR`` and ``SUFFIX`` are supported." +"except ``\"NEAR\"``, ``\"SIMILAR\"`` and ``\"SUFFIX\"`` are supported." msgstr "" -"利用可能なモード名は :ref:`query-default-mode` を見てください。 ``NEAR`` 、 " -"``SIMILAR`` と ``SUFFIX`` 以外のすべてのモード名をサポートしています。" +"利用可能なモード名は :ref:`query-default-mode` を見てください。 ``\"NEAR" +"\"`` 、 ``\"SIMILAR\"`` と ``\"SUFFIX\"`` 以外のすべてのモード名をサポートし" +"ています。" msgid "``condition_column_name``" msgstr "" @@ -20605,11 +20606,11 @@ msgstr "" "reference/grn_expr/query_syntax` を見てください。" msgid "" -"Here are available modes. The default is ``MATCH`` mode. It does full text " -"search." +"Here are available modes. The default is ``\"MATCH\"`` mode. It does full " +"text search." msgstr "" -"以下は利用可能なモードです。デフォルトは ``MATCH`` モードです。このモードでは" -"全文検索をします。" +"以下は利用可能なモードです。デフォルトは ``\"MATCH\"`` モードです。このモード" +"では全文検索をします。" msgid "Mode" msgstr "モード" @@ -20617,40 +20618,40 @@ msgstr "モード" msgid "Aliases" msgstr "別名" -msgid "``EQUAL``" +msgid "``\"EQUAL\"``" msgstr "" -msgid "``==``" +msgid "``\"==\"``" msgstr "" msgid "It uses :ref:`query-syntax-equal-condition` as the default mode." msgstr "" "デフォルトのモードとして :ref:`query-syntax-equal-condition` を使います。" -msgid "``NOT_EQUAL``" +msgid "``\"NOT_EQUAL\"``" msgstr "" -msgid "``!=``" +msgid "``\"!=\"``" msgstr "" msgid "It uses :ref:`query-syntax-not-equal-condition` as the default mode." msgstr "" "デフォルトのモードとして :ref:`query-syntax-not-equal-condition` を使います。" -msgid "``LESS``" +msgid "``\"LESS\"``" msgstr "" -msgid "``<``" +msgid "``\"<\"``" msgstr "" msgid "It uses :ref:`query-syntax-less-than-condition` as the default mode." msgstr "" "デフォルトのモードとして :ref:`query-syntax-less-than-condition` を使います。" -msgid "``GREATER``" +msgid "``\"GREATER\"``" msgstr "" -msgid "``>``" +msgid "``\">\"``" msgstr "" msgid "It uses :ref:`query-syntax-greater-than-condition` as the default mode." @@ -20658,10 +20659,10 @@ msgstr "" "デフォルトのモードとして :ref:`query-syntax-greater-than-condition` を使いま" "す。" -msgid "``LESS_EQUAL``" +msgid "``\"LESS_EQUAL\"``" msgstr "" -msgid "``<=``" +msgid "``\"<=\"``" msgstr "" msgid "" @@ -20670,10 +20671,10 @@ msgstr "" "デフォルトのモードとして :ref:`query-syntax-less-than-or-equal-condition` を" "使います。" -msgid "``GREATER_EQUAL``" +msgid "``\"GREATER_EQUAL\"``" msgstr "" -msgid "``>=``" +msgid "``\">=\"``" msgstr "" msgid "" @@ -20683,10 +20684,10 @@ msgstr "" "デフォルトのモードとして :ref:`query-syntax-greater-than-or-equal-condition` " "を使います。" -msgid "``MATCH``" +msgid "``\"MATCH\"``" msgstr "" -msgid "``@``" +msgid "``\"@\"``" msgstr "" msgid "" @@ -20698,10 +20699,10 @@ msgstr "" msgid "It's the default." msgstr "これがデフォルトです。" -msgid "``NEAR``" +msgid "``\"NEAR\"``" msgstr "" -msgid "``*N``" +msgid "``\"*N\"``" msgstr "" msgid "It uses :ref:`query-syntax-near-search-condition` as the default mode." @@ -20709,10 +20710,10 @@ msgstr "" "デフォルトのモードとして :ref:`query-syntax-near-search-condition` を使いま" "す。" -msgid "``SIMILAR``" +msgid "``\"SIMILAR\"``" msgstr "" -msgid "``*S``" +msgid "``\"*S\"``" msgstr "" msgid "" @@ -20721,10 +20722,10 @@ msgstr "" "デフォルトのモードとして :ref:`query-syntax-similar-search-condition` を使い" "ます。" -msgid "``PREFIX``" +msgid "``\"PREFIX\"``" msgstr "" -msgid "``^``, ``@^``" +msgid "``\"^\"``, ``\"@^\"``" msgstr "" msgid "" @@ -20733,10 +20734,10 @@ msgstr "" "デフォルトのモードとして :ref:`query-syntax-prefix-search-condition` を使いま" "す。" -msgid "``SUFFIX``" +msgid "``\"SUFFIX\"``" msgstr "" -msgid "``$``, ``@$``" +msgid "``\"$\"``, ``\"@$\"``" msgstr "" msgid "" @@ -20745,10 +20746,10 @@ msgstr "" "デフォルトのモードとして :ref:`query-syntax-suffix-search-condition` を使いま" "す。" -msgid "``REGEXP``" +msgid "``\"REGEXP\"``" msgstr "" -msgid "``~``, ``@~``" +msgid "``\"~\"``, ``\"@~\"``" msgstr "" msgid "" @@ -21159,23 +21160,23 @@ msgstr "" msgid "Specifies a vector value to be searched an element." msgstr "検索対象のベクターを指定します。" -msgid "``operator`` is optional." -msgstr "``operator`` は省略可能です。" - -msgid "``operator``" -msgstr "" +msgid "``mode`` is optional." +msgstr "``mode`` は省略可能です。" msgid "" -"Specifies an operator to determine how to compare each value with :ref:" +"Specifies a mode that specifies how to compare each element with :ref:" "`vector-find-value`." -msgstr ":ref:`vector-find-value` と各要素を比較する方法を指定します。" +msgstr "" +":ref:`vector-find-value` と各要素を比較する方法(モード)を指定します。" msgid "" -"Here are available operators. The default is ``EQUAL`` operator. It does " -"equality comparison." +"The default mode is ``\"EQUAL\"``. Note that :ref:`query-default-mode` says " +"the default mode is ``\"MATCH\"`` but the default mode of ``vector_find`` is " +"``\"EQUAL\"``." msgstr "" -"以下は利用可能なオペレーターです。デフォルトは ``EQUAL`` オペレーターです。こ" -"のオペレーターは等価比較をします。" +"デフォルトのモードは ``\"EQUAL\"`` です。 :ref:`query-default-mode` ではデ" +"フォルトのモードは ``\"MATCH\"`` ですが、 ``vector_find`` のデフォルトのモー" +"ドは ``\"EQUAL\"`` です。" msgid "The matched element on match, ``null`` otherwise." msgstr "マッチした場合はマッチした要素。マッチしない場合は ``null`` 。" Renamed: doc/source/example/reference/functions/vector_find/usage_find_mode.log (+0 -0) 100% =================================================================== Modified: doc/source/reference/functions/in_records.rst (+2 -1) =================================================================== --- doc/source/reference/functions/in_records.rst 2018-06-28 12:32:20 +0900 (eea5ccea7) +++ doc/source/reference/functions/in_records.rst 2018-06-28 12:51:11 +0900 (dc6b83b61) @@ -171,7 +171,8 @@ Specifies a value to be compared. Specifies a mode name that specifies how to compare :ref:`in-records-value` with a value of :ref:`in-records-condition-column-name`. -See :ref:`query-default-mode` for available mode names. All mode names except ``NEAR``, ``SIMILAR`` and ``SUFFIX`` are supported. +See :ref:`query-default-mode` for available mode names. All mode names +except ``"NEAR"``, ``"SIMILAR"`` and ``"SUFFIX"`` are supported. .. _in-records-condition-column-name: Modified: doc/source/reference/functions/query.rst (+26 -26) =================================================================== --- doc/source/reference/functions/query.rst 2018-06-28 12:32:20 +0900 (e8a82adeb) +++ doc/source/reference/functions/query.rst 2018-06-28 12:51:11 +0900 (4bab3689e) @@ -171,8 +171,8 @@ used when you just specify ``keyword`` instead of ``column:@keyword``. See :doc:`/reference/grn_expr/query_syntax` for more syntax details. -Here are available modes. The default is ``MATCH`` mode. It does full -text search. +Here are available modes. The default is ``"MATCH"`` mode. It does +full text search. .. list-table:: :header-rows: 1 @@ -180,50 +180,50 @@ text search. * - Mode - Aliases - Description - * - ``EQUAL`` - - ``==`` + * - ``"EQUAL"`` + - ``"=="`` - It uses :ref:`query-syntax-equal-condition` as the default mode. - * - ``NOT_EQUAL`` - - ``!=`` + * - ``"NOT_EQUAL"`` + - ``"!="`` - It uses :ref:`query-syntax-not-equal-condition` as the default mode. - * - ``LESS`` - - ``<`` + * - ``"LESS"`` + - ``"<"`` - It uses :ref:`query-syntax-less-than-condition` as the default mode. - * - ``GREATER`` - - ``>`` + * - ``"GREATER"`` + - ``">"`` - It uses :ref:`query-syntax-greater-than-condition` as the default mode. - * - ``LESS_EQUAL`` - - ``<=`` + * - ``"LESS_EQUAL"`` + - ``"<="`` - It uses :ref:`query-syntax-less-than-or-equal-condition` as the default mode. - * - ``GREATER_EQUAL`` - - ``>=`` + * - ``"GREATER_EQUAL"`` + - ``">="`` - It uses :ref:`query-syntax-greater-than-or-equal-condition` as the default mode. - * - ``MATCH`` - - ``@`` + * - ``"MATCH"`` + - ``"@"`` - It uses :ref:`query-syntax-full-text-search-condition` as the default mode. It's the default. - * - ``NEAR`` - - ``*N`` + * - ``"NEAR"`` + - ``"*N"`` - It uses :ref:`query-syntax-near-search-condition` as the default mode. - * - ``SIMILAR`` - - ``*S`` + * - ``"SIMILAR"`` + - ``"*S"`` - It uses :ref:`query-syntax-similar-search-condition` as the default mode. - * - ``PREFIX`` - - ``^``, ``@^`` + * - ``"PREFIX"`` + - ``"^"``, ``"@^"`` - It uses :ref:`query-syntax-prefix-search-condition` as the default mode. - * - ``SUFFIX`` - - ``$``, ``@$`` + * - ``"SUFFIX"`` + - ``"$"``, ``"@$"`` - It uses :ref:`query-syntax-suffix-search-condition` as the default mode. - * - ``REGEXP`` - - ``~``, ``@~`` + * - ``"REGEXP"`` + - ``"~"``, ``"@~"`` - It uses :ref:`query-syntax-regular-expression-condition` as the default mode. Modified: doc/source/reference/functions/vector_find.rst (+13 -50) =================================================================== --- doc/source/reference/functions/vector_find.rst 2018-06-28 12:32:20 +0900 (005e4fc7f) +++ doc/source/reference/functions/vector_find.rst 2018-06-28 12:51:11 +0900 (9bcd1794d) @@ -32,7 +32,7 @@ Syntax ``vector_find`` has two or three parameters:: vector_find(vector, value); - vector_find(vector, value, operator); + vector_find(vector, value, mode); If you omit the third argument, each element in the ``vector`` is compared with ``value`` by equality comparison. @@ -86,7 +86,7 @@ You can customize how to compare with each value by the third argument. Here is a usage to use full text search to find an element: .. groonga-command -.. include:: ../../example/reference/functions/vector_find/usage_find_operator.log +.. include:: ../../example/reference/functions/vector_find/usage_find_mode.log .. select \ .. --table Memos \ .. --output_columns 'tags, vector_find(tags, "roonga", "@")' @@ -135,59 +135,22 @@ Specifies a value to be compared. Optional parameters ^^^^^^^^^^^^^^^^^^^ -``operator`` is optional. +``mode`` is optional. -.. _vector-find-operator: +.. _vector-find-mode: -``operator`` -"""""""""""" +``mode`` +"""""""" -Specifies an operator to determine how to compare each value with +Specifies a mode that specifies how to compare each element with :ref:`vector-find-value`. -Here are available operators. The default is ``EQUAL`` operator. It -does equality comparison. - -.. list-table:: - :header-rows: 1 - - * - Mode - - Aliases - - Description - * - ``EQUAL`` - - ``==`` - - It uses :ref:`query-syntax-equal-condition` as the default mode. - - It's the default. - * - ``NOT_EQUAL`` - - ``!=`` - - It uses :ref:`query-syntax-not-equal-condition` as the default mode. - * - ``LESS`` - - ``<`` - - It uses :ref:`query-syntax-less-than-condition` as the default mode. - * - ``GREATER`` - - ``>`` - - It uses :ref:`query-syntax-greater-than-condition` as the default mode. - * - ``LESS_EQUAL`` - - ``<=`` - - It uses :ref:`query-syntax-less-than-or-equal-condition` as the - default mode. - * - ``GREATER_EQUAL`` - - ``>=`` - - It uses :ref:`query-syntax-greater-than-or-equal-condition` as the - default mode. - * - ``MATCH`` - - ``@`` - - It uses :ref:`query-syntax-full-text-search-condition` as the - default mode. - * - ``PREFIX`` - - ``^``, ``@^`` - - It uses :ref:`query-syntax-prefix-search-condition` as the default - mode. - * - ``REGEXP`` - - ``~``, ``@~`` - - It uses :ref:`query-syntax-regular-expression-condition` as the default - mode. +See :ref:`query-default-mode` for available mode names. All mode names +except ``"NEAR"``, ``"SIMILAR"`` and ``"SUFFIX"`` are supported. + +The default mode is ``"EQUAL"``. Note that :ref:`query-default-mode` +says the default mode is ``"MATCH"`` but the default mode of +``vector_find`` is ``"EQUAL"``. Return value ------------ Modified: plugins/functions/vector.c (+18 -18) =================================================================== --- plugins/functions/vector.c 2018-06-28 12:32:20 +0900 (a7c52b786) +++ plugins/functions/vector.c 2018-06-28 12:51:11 +0900 (1fe11ff03) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2015-2017 Brazil + Copyright(C) 2015-2018 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -375,7 +375,7 @@ static grn_obj * func_vector_find_vector(grn_ctx *ctx, grn_obj *target, grn_obj *query, - grn_operator operator, + grn_operator mode, grn_user_data *user_data) { grn_obj *found_element = NULL; @@ -384,7 +384,7 @@ func_vector_find_vector(grn_ctx *ctx, unsigned int i; unsigned int n_elements = 0; - exec = grn_operator_to_exec_func(operator); + exec = grn_operator_to_exec_func(mode); GRN_VOID_INIT(&element); n_elements = grn_vector_size(ctx, target); for (i = 0; i < n_elements; i++) { @@ -415,7 +415,7 @@ static grn_obj * func_vector_find_uvector_number(grn_ctx *ctx, grn_obj *target, grn_obj *query, - grn_operator operator, + grn_operator mode, grn_user_data *user_data) { grn_obj *found_element = NULL; @@ -436,7 +436,7 @@ func_vector_find_uvector_number(grn_ctx *ctx, } element_size = grn_uvector_element_size(ctx, target); n_elements = GRN_BULK_VSIZE(target) / element_size; - if (operator == GRN_OP_EQUAL) { + if (mode == GRN_OP_EQUAL) { for (i = 0; i < n_elements; i++) { if (memcmp(GRN_BULK_HEAD(target) + (i * element_size), GRN_BULK_HEAD(query_number), @@ -456,7 +456,7 @@ func_vector_find_uvector_number(grn_ctx *ctx, grn_operator_exec_func *exec; grn_obj element; - exec = grn_operator_to_exec_func(operator); + exec = grn_operator_to_exec_func(mode); GRN_VALUE_FIX_SIZE_INIT(&element, 0, target->header.domain); for (i = 0; i < n_elements; i++) { GRN_BULK_REWIND(&element); @@ -489,7 +489,7 @@ static grn_obj * func_vector_find_uvector_record(grn_ctx *ctx, grn_obj *target, grn_obj *query, - grn_operator operator, + grn_operator mode, grn_user_data *user_data) { grn_obj *found_element = NULL; @@ -497,7 +497,7 @@ func_vector_find_uvector_record(grn_ctx *ctx, grn_id *ids; size_t i, n_elements; - if (operator != GRN_OP_EQUAL) { + if (mode != GRN_OP_EQUAL) { return NULL; } @@ -533,14 +533,14 @@ static grn_obj * func_vector_find_uvector(grn_ctx *ctx, grn_obj *target, grn_obj *query, - grn_operator operator, + grn_operator mode, grn_user_data *user_data) { if (grn_type_id_is_number_family(ctx, target->header.domain)) { return func_vector_find_uvector_number(ctx, target, query, - operator, + mode, user_data); } else if (grn_type_id_is_builtin(ctx, target->header.domain)) { return NULL; @@ -548,7 +548,7 @@ func_vector_find_uvector(grn_ctx *ctx, return func_vector_find_uvector_record(ctx, target, query, - operator, + mode, user_data); } } @@ -557,7 +557,7 @@ static grn_obj * func_vector_find_pvector(grn_ctx *ctx, grn_obj *target, grn_obj *query, - grn_operator operator, + grn_operator mode, grn_user_data *user_data) { grn_obj *found_element = NULL; @@ -566,7 +566,7 @@ func_vector_find_pvector(grn_ctx *ctx, unsigned int i; unsigned int n_elements = 0; - exec = grn_operator_to_exec_func(operator); + exec = grn_operator_to_exec_func(mode); elements = (grn_obj **)GRN_BULK_HEAD(target); n_elements = sizeof(grn_id) / GRN_BULK_VSIZE(target); for (i = 0; i < n_elements; i++) { @@ -592,7 +592,7 @@ func_vector_find(grn_ctx *ctx, int n_args, grn_obj **args, const char *context = "vector_find()"; grn_obj *target; grn_obj *query = NULL; - grn_operator operator = GRN_OP_EQUAL; + grn_operator mode = GRN_OP_EQUAL; grn_obj *found_element = NULL; if (n_args < 2 || n_args > 3) { @@ -606,7 +606,7 @@ func_vector_find(grn_ctx *ctx, int n_args, grn_obj **args, target = args[0]; query = args[1]; if (n_args == 3) { - operator = grn_plugin_proc_get_value_mode(ctx, args[2], operator, context); + mode = grn_plugin_proc_get_value_mode(ctx, args[2], mode, context); if (ctx->rc != GRN_SUCCESS) { return NULL; } @@ -636,13 +636,13 @@ func_vector_find(grn_ctx *ctx, int n_args, grn_obj **args, if (target->header.type == GRN_VECTOR) { found_element = - func_vector_find_vector(ctx, target, query, operator, user_data); + func_vector_find_vector(ctx, target, query, mode, user_data); } else if (target->header.type == GRN_UVECTOR) { found_element = - func_vector_find_uvector(ctx, target, query, operator, user_data); + func_vector_find_uvector(ctx, target, query, mode, user_data); } else if (target->header.type == GRN_PVECTOR) { found_element = - func_vector_find_pvector(ctx, target, query, operator, user_data); + func_vector_find_pvector(ctx, target, query, mode, user_data); } if (!found_element) { -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180628/af92e3ab/attachment-0001.htm