[Groonga-commit] groonga/groonga at 2bcf759 [master] doc: add indexes with weight description (#965)

Back to archive index
Kentaro Hayashi null+****@clear*****
Thu May 23 17:11:41 JST 2019


Kentaro Hayashi	2019-05-23 17:11:41 +0900 (Thu, 23 May 2019)

  Revision: 2bcf7591d648007682facb3c980b3236cda43131
  https://github.com/groonga/groonga/commit/2bcf7591d648007682facb3c980b3236cda43131

  Message:
    doc: add indexes with weight description (#965)
    
    * doc: add index with weight description
    
    * doc: translate po
    
    * doc: add index with weight example

  Added files:
    doc/source/example/tutorial/match_columns-indexes-with-weight.log
  Modified files:
    doc/locale/ja/LC_MESSAGES/tutorial.po
    doc/source/tutorial/match_columns.rst

  Modified: doc/locale/ja/LC_MESSAGES/tutorial.po (+52 -2)
===================================================================
--- doc/locale/ja/LC_MESSAGES/tutorial.po    2019-05-22 18:12:32 +0900 (a93d0acc4)
+++ doc/locale/ja/LC_MESSAGES/tutorial.po    2019-05-23 17:11:41 +0900 (5e8ed14fd)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: 1.2.1\n"
 "Report-Msgid-Bugs-To: \n"
-"PO-Revision-Date: 2017-05-10 17:22+0900\n"
+"PO-Revision-Date: 2019-05-23 14:19+0900\n"
 "Last-Translator: Masafumi Yokoyama <yokoy****@clear*****>\n"
 "Language-Team: Japanese\n"
 "Language: ja\n"
@@ -1601,8 +1601,58 @@ msgstr ""
 msgid "Indexes with Weight"
 msgstr "インデックスの重み"
 
-msgid "TODO"
+msgid ""
+"If index columns are created for data columns, you can search by indexes "
+"with weight. For example, let's try to search blog entries by indexes with "
+"weight which contains ``Groonga`` as important keyword in ``Blog1`` table. "
+"Generally speaking, an important keyword tend to be included in blog title, "
+"so if ``title`` column contains ``Groonga``, its score ( ``_score`` ) must "
+"be raised in contrast to ``message`` column. The indexes with weight is used "
+"for such a purpose."
+msgstr ""
+"もし、インデックスカラムがデータカラムに対して作成されていたら、インデックス"
+"の重みを使って検索できます。例えば、 ``Groonga`` が重要なキーワードとしてブロ"
+"グエントリに含まれている ``Blog1`` テーブルをインデックスの重みを使って検索し"
+"てみましょう。一般的に重要なキーワードはブログのタイトルに含まれます。そのた"
+"め、 ``title`` カラムが ``Groonga`` を含んでいればそのスコア( ``_score`` )が "
+"``message`` カラムにくらべて高くないといけません。インデックスの重みはそのよ"
+"うな目的に使われます。"
+
+msgid ""
+"Here is the example which search blog entries with ``Groonga`` as important "
+"keyword in ``title`` or ``message`` columns."
+msgstr ""
+"次は、``tittle`` や ``message`` カラムに重要なキーワードとして ``Groonga`` が"
+"含まれているブログエントリを検索する例です。"
+
+msgid ""
+"The sample schema and data is same as :ref:`creating-column-index-against-"
+"each-column`."
+msgstr ""
+"サンプルのスキーマとデータは :ref:`creating-column-index-against-each-"
+"column` と同じです。"
+
+msgid ""
+"In above query, ``'IndexBlog1.index_title * 10 || IndexBlog1."
+"index_message'`` is specified for ``--match_columns``. It means that if "
+"``title`` column (search ``title`` column using ``IndexBlog1.index_title`` "
+"index) matches to ``Groonga``, its weight is multiplied to 10 and if "
+"``message`` column (search ``message`` column using ``IndexBlog1."
+"index_message`` index) matches to ``Groonga``, its weight is 1 (default). If "
+"``Groonga`` matches to ``title`` and ``message``, its weight is 11 (10 + 1) "
+"in this case."
+msgstr ""
+"上記の例では、 ``'IndexBlog1.index_title * 10 || IndexBlog1.index_message'`` "
+"が ``--match_columns`` に指定されています。これは ``title`` カラム"
+"( ``IndexBlog1.index_title`` インデックスを使って検索)が ``Groonga`` にマッチ"
+"したら、その重みは10倍されます。もし ``message`` カラム( ``IndexBlog1."
+"index_message`` インデックスを使って検索)が ``Groonga`` にマッチしたら、その"
+"重みは1(既定値)になります。もし ``Groonga`` が ``title`` と ``message`` カラ"
+"ムの両方にマッチしたら、その重みはこの場合11(10 + 1)になります。"
+
+msgid "As a result, ``Groonga test`` blog entry is listed in first."
 msgstr ""
+"結果として、 ``Groonga test`` ブログエントリがリストの最初に表示されます。"
 
 msgid "Let's create micro-blog"
 msgstr "マイクロブログ検索システムの作成"

  Added: doc/source/example/tutorial/match_columns-indexes-with-weight.log (+53 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/tutorial/match_columns-indexes-with-weight.log    2019-05-23 17:11:41 +0900 (dd1a22961)
@@ -0,0 +1,53 @@
+Execution example::
+
+  select --table Blog1 --match_columns 'IndexBlog1.index_title * 10 || IndexBlog1.index_message' --query 'Groonga' --output_columns "_id, _score, *"
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         3
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_score", 
+  #           "Int32"
+  #         ], 
+  #         [
+  #           "message", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "title", 
+  #           "ShortText"
+  #         ]
+  #       ], 
+  #       [
+  #         1, 
+  #         11, 
+  #         "Groonga message", 
+  #         "Groonga test"
+  #       ], 
+  #       [
+  #         3, 
+  #         10, 
+  #         "none", 
+  #         "Groonga message"
+  #       ], 
+  #       [
+  #         2, 
+  #         1, 
+  #         "rakutan eggs 4 - 4 Groonga moritars", 
+  #         "baseball result"
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Modified: doc/source/tutorial/match_columns.rst (+18 -2)
===================================================================
--- doc/source/tutorial/match_columns.rst    2019-05-22 18:12:32 +0900 (f1ff2ce14)
+++ doc/source/tutorial/match_columns.rst    2019-05-23 17:11:41 +0900 (8bbc62226)
@@ -15,6 +15,8 @@ Groonga supports full-text search against multiple columns. Let's consider blog
 
 In such a case, there are two ways to create indexes. One way is creating column index against each column. The other way is creating one column index against multiple columns. Either way, Groonga supports similar full-text search syntax.
 
+.. _creating-column-index-against-each-column:
+
 Creating column index against each column
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
@@ -290,6 +292,20 @@ On the other hand, the second one matches one article only because of ``Replies2
 Indexes with Weight
 -------------------
 
-TODO
+If index columns are created for data columns, you can search by indexes with weight.
+For example, let's try to search blog entries by indexes with weight which contains ``Groonga`` as important keyword in ``Blog1`` table.
+Generally speaking, an important keyword tend to be included in blog title, so if ``title`` column contains ``Groonga``, its score ( ``_score`` ) must be raised in contrast to ``message`` column. The indexes with weight is used for such a purpose.
+
+Here is the example which search blog entries with ``Groonga`` as important keyword in ``title`` or ``message`` columns.
+
+The sample schema and data is same as :ref:`creating-column-index-against-each-column`.
+
+.. groonga-command
+.. include:: ../example/tutorial/match_columns-indexes-with-weight.log
+.. select --table Blog1 --match_columns 'IndexBlog1.index_title * 10 || IndexBlog1.index_message' --query 'Groonga' --output_columns "_id, _score, *"
+
+In above query, ``'IndexBlog1.index_title * 10 || IndexBlog1.index_message'`` is specified for ``--match_columns``.
+It means that if ``title`` column (search ``title`` column using ``IndexBlog1.index_title`` index) matches to ``Groonga``, its weight is multiplied to 10 and if ``message`` column (search ``message`` column using ``IndexBlog1.index_message`` index) matches to ``Groonga``,
+its weight is 1 (default). If ``Groonga`` matches to ``title`` and ``message``, its weight is 11 (10 + 1) in this case.
 
-.. TODO: match_columnsの重み指定機能についても触れる。
+As a result, ``Groonga test`` blog entry is listed in first.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190523/6859729a/attachment-0001.html>


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