[Groonga-commit] groonga/groonga at e626eb7 [master] doc cast_loose: add

Back to archive index
Yasuhiro Horimoto null+****@clear*****
Thu Oct 11 16:13:26 JST 2018


Yasuhiro Horimoto	2018-10-11 16:13:26 +0900 (Thu, 11 Oct 2018)

  Revision: e626eb78465d466f37220f18da4445d9b4a9ed38
  https://github.com/groonga/groonga/commit/e626eb78465d466f37220f18da4445d9b4a9ed38

  Message:
    doc cast_loose: add

  Added files:
    doc/source/example/reference/functions/cast_loose/usage_basic.log
    doc/source/example/reference/functions/cast_loose/usage_setup.log
    doc/source/reference/functions/cast_loose.rst
  Modified files:
    doc/locale/ja/LC_MESSAGES/reference.po

  Modified: doc/locale/ja/LC_MESSAGES/reference.po (+49 -9)
===================================================================
--- doc/locale/ja/LC_MESSAGES/reference.po    2018-10-11 16:04:59 +0900 (2471098ec)
+++ doc/locale/ja/LC_MESSAGES/reference.po    2018-10-11 16:13:26 +0900 (3ac25e88e)
@@ -19332,6 +19332,46 @@ msgstr ""
 "``between`` は指定した範囲にカラムの値が含まれるかを返します。もし該当するレ"
 "コードがあれば、 ``true`` を返します。そうでなければ ``false`` を返します。"
 
+msgid "``cast_loose``"
+msgstr ""
+
+msgid ""
+"``cast_loose`` cast loosely a string to the type specified. If the target "
+"string can cast, ``cast_loose`` has cast the string to the type specified by "
+"the argument. If the target string can't cast, ``cast_loose`` set the "
+"default value specified by the argument."
+msgstr ""
+"``cast_loose`` は文字列を指定した型へ緩くキャストします。対象の文字列がキャス"
+"トできる場合、 ``cast_loose`` は、文字列を引数で指定された型にキャストしま"
+"す。対象の文字列がキャストできない場合、 ``cast_loose`` は、引数で指定された"
+"デフォルト値を設定します。"
+
+msgid "``cast_loose`` has three parameters::"
+msgstr "``cast_loose`` は3つの引数を受け取ります。"
+
+msgid "``type`` : Specify the type of after casted value."
+msgstr "``type`` : キャスト後の値の型を指定します。"
+
+msgid "``value`` : Specify the target of a cast."
+msgstr "``value`` : キャスト対象を指定します。"
+
+msgid "``default_value`` : Speficy the value of setting when failed a cast."
+msgstr "``default_value`` : キャストに失敗した時に設定する値を指定します。"
+
+msgid ""
+"The following example is cast \"100\" and \"100abc\" with ``cast_loose``."
+msgstr "以下の例では、\"100\"と\"100abc\"を ``cast_loose`` でキャストします。"
+
+msgid ""
+"``cast_loose`` cast \"100\" to 100 and \"100abc\" to 10. Because \"100\" can "
+"cast to the Int64 and \"100abc\" can't cast to the Int64."
+msgstr ""
+"``cast_loose`` は\"100\"を100に\"100abc\"を10にキャストします。\"100\"はInt64"
+"にキャストできますが、\"100abc\"はInt64にキャストできないためです。"
+
+msgid "``cast_loose`` returns the casted value or default value."
+msgstr "``cast_loose`` はキャスト後の値かデフォルト値を返します。"
+
 msgid "edit_distance"
 msgstr ""
 
@@ -25354,6 +25394,15 @@ msgid "Score is computed as TF-IDF based algorithm."
 msgstr "スコアーはTF-IDFベースのアルゴリズムで計算します。"
 
 msgid ""
+"You don't need to resolve scoring only by score function. Score function is "
+"highly depends on search query. You may be able to use metadata of matched "
+"record."
+msgstr ""
+"スコアー関数だけでスコアの計算をする必要はありません。スコアー関数は検索クエ"
+"リーに非常に依存しています。検索クエリーだけでなく、マッチしたレコードのメタ"
+"データも使えないか検討しましょう。"
+
+msgid ""
 "For example, Google uses `PageRank <https://en.wikipedia.org/wiki/"
 "PageRank>`_ for scoring. You may be able to use data type (\"title\" data "
 "are important rather than \"memo\" data), tag, geolocation and so on."
@@ -25366,15 +25415,6 @@ msgstr ""
 msgid "Please stop to think about only score function for scoring."
 msgstr "スコアーの計算をスコアー関数だけで考えることはやめましょう。"
 
-msgid ""
-"You don't need to resolve scoring only by score function. Score function is "
-"highly depends on search query. You may be able to use metadata of matched "
-"record."
-msgstr ""
-"スコアー関数だけでスコアの計算をする必要はありません。スコアー関数は検索クエ"
-"リーに非常に依存しています。検索クエリーだけでなく、マッチしたレコードのメタ"
-"データも使えないか検討しましょう。"
-
 msgid "Sharding"
 msgstr "シャーディング"
 

  Added: doc/source/example/reference/functions/cast_loose/usage_basic.log (+35 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/functions/cast_loose/usage_basic.log    2018-10-11 16:13:26 +0900 (ae5b48933)
@@ -0,0 +1,35 @@
+Execution example::
+
+  select Data   --output_columns '_key, cast_loose(Int64, _key, 10)'
+  # [
+  #   [
+  #     0,
+  #     0.0,
+  #     0.0
+  #   ],
+  #   [
+  #     [
+  #       [
+  #         2
+  #       ],
+  #       [
+  #         [
+  #           "_key",
+  #           "ShortText"
+  #         ],
+  #         [
+  #           "cast_loose",
+  #           null
+  #         ]
+  #       ],
+  #       [
+  #         "100abc",
+  #         10
+  #       ]
+  #       [
+  #         "100",
+  #         100
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/functions/cast_loose/usage_setup.log (+10 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/functions/cast_loose/usage_setup.log    2018-10-11 16:13:26 +0900 (410f46392)
@@ -0,0 +1,10 @@
+Execution example::
+
+  table_create Data TABLE_HASH_KEY ShortText
+  # [[0, 1337566253.89858, 0.000355720520019531], true]
+  load --table Data
+  [
+  {"_key": "100abc"}
+  {"_key": "100"}
+  ]
+  # [[0, 1337566253.89858, 0.000355720520019531], 2]

  Added: doc/source/reference/functions/cast_loose.rst (+65 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/reference/functions/cast_loose.rst    2018-10-11 16:13:26 +0900 (1a65272d9)
@@ -0,0 +1,65 @@
+.. -*- rst -*-
+
+.. highlightlang:: none
+
+.. groonga-command
+.. database: functions_cast_loose
+
+``cast_loose``
+================
+
+Summary
+-------
+
+.. versionadded:: 8.0.8
+
+``cast_loose`` cast loosely a string to the type specified.
+If the target string can cast, ``cast_loose`` has cast the string to the type specified by the argument.
+If the target string can't cast, ``cast_loose`` set the default value specified by the argument.
+
+Syntax
+------
+
+``cast_loose`` has three parameters::
+
+  cast_loose(type, value, defaul_value)
+
+``type`` : Specify the type of after casted value.
+
+``value`` : Specify the target of a cast.
+
+``default_value`` : Speficy the value of setting when failed a cast.
+
+Usage
+-----
+
+Here are a schema definition and sample data to show usage.
+
+.. groonga-command
+.. include:: ../../example/reference/functions/cast_loose/usage_setup.log
+.. table_create Data TABLE_HASH_KEY ShortText
+.. load --table Data
+.. [
+.. {"_key": "100abc"}
+.. {"_key": "100"}
+.. ]
+
+
+The following example is cast "100" and "100abc" with ``cast_loose``.
+
+.. groonga-command
+.. include:: ../../example/reference/functions/cast_loose/usage_basic.log
+.. select Data   --output_columns '_key, cast_loose(Int64, _key, 10)'
+
+``cast_loose`` cast "100" to 100 and "100abc" to 10.
+Because "100" can cast to the Int64 and "100abc" can't cast to the Int64.
+
+Return value
+------------
+
+``cast_loose`` returns the casted value or default value.
+
+See also
+--------
+
+* :doc:`/reference/commands/select`
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20181011/01e419af/attachment-0001.html>


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