Kouhei Sutou
null+****@clear*****
Mon Mar 10 17:45:55 JST 2014
Kouhei Sutou 2014-03-10 17:45:55 +0900 (Mon, 10 Mar 2014) New Revision: 84ec4eb912c59f6c19cdc956c00c8791a88e4282 https://github.com/groonga/groonga/commit/84ec4eb912c59f6c19cdc956c00c8791a88e4282 Message: doc select: describe about --adjuster Added files: doc/source/example/reference/commands/select/adjuster_multiple.log doc/source/example/reference/commands/select/adjuster_no_weight.log doc/source/example/reference/commands/select/adjuster_one.log Modified files: doc/source/reference/columns/vector.txt doc/source/reference/commands/select.txt Added: doc/source/example/reference/commands/select/adjuster_multiple.log (+59 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/select/adjuster_multiple.log 2014-03-10 17:45:55 +0900 (1f58cd9) @@ -0,0 +1,59 @@ +Execution example:: + + select Entries \ + --filter true \ + --adjuster 'content @ "groonga" * 5 + content @ "started" * 3' \ + --output_columns _key,content,_score + # [ + # [ + # 0, + # 1337566253.89858, + # 0.000355720520019531 + # ], + # [ + # [ + # [ + # 5 + # ], + # [ + # [ + # "_key", + # "ShortText" + # ], + # [ + # "content", + # "Text" + # ], + # [ + # "_score", + # "Int32" + # ] + # ], + # [ + # "The first post!", + # "Welcome! This is my first post!", + # 1 + # ], + # [ + # "Groonga", + # "I started to use groonga. It's very fast!", + # 9 + # ], + # [ + # "Mroonga", + # "I also started to use mroonga. It's also very fast! Really fast!", + # 4 + # ], + # [ + # "Good-bye Senna", + # "I migrated all Senna system!", + # 1 + # ], + # [ + # "Good-bye Tritonn", + # "I also migrated all Tritonn system!", + # 1 + # ] + # ] + # ] + # ] Added: doc/source/example/reference/commands/select/adjuster_no_weight.log (+59 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/select/adjuster_no_weight.log 2014-03-10 17:45:55 +0900 (94baa82) @@ -0,0 +1,59 @@ +Execution example:: + + select Entries \ + --filter true \ + --adjuster 'content @ "groonga"' \ + --output_columns _key,content,_score + # [ + # [ + # 0, + # 1337566253.89858, + # 0.000355720520019531 + # ], + # [ + # [ + # [ + # 5 + # ], + # [ + # [ + # "_key", + # "ShortText" + # ], + # [ + # "content", + # "Text" + # ], + # [ + # "_score", + # "Int32" + # ] + # ], + # [ + # "The first post!", + # "Welcome! This is my first post!", + # 1 + # ], + # [ + # "Groonga", + # "I started to use groonga. It's very fast!", + # 2 + # ], + # [ + # "Mroonga", + # "I also started to use mroonga. It's also very fast! Really fast!", + # 1 + # ], + # [ + # "Good-bye Senna", + # "I migrated all Senna system!", + # 1 + # ], + # [ + # "Good-bye Tritonn", + # "I also migrated all Tritonn system!", + # 1 + # ] + # ] + # ] + # ] Added: doc/source/example/reference/commands/select/adjuster_one.log (+59 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/select/adjuster_one.log 2014-03-10 17:45:55 +0900 (8e3de98) @@ -0,0 +1,59 @@ +Execution example:: + + select Entries \ + --filter true \ + --adjuster 'content @ "groonga" * 5' \ + --output_columns _key,content,_score + # [ + # [ + # 0, + # 1337566253.89858, + # 0.000355720520019531 + # ], + # [ + # [ + # [ + # 5 + # ], + # [ + # [ + # "_key", + # "ShortText" + # ], + # [ + # "content", + # "Text" + # ], + # [ + # "_score", + # "Int32" + # ] + # ], + # [ + # "The first post!", + # "Welcome! This is my first post!", + # 1 + # ], + # [ + # "Groonga", + # "I started to use groonga. It's very fast!", + # 6 + # ], + # [ + # "Mroonga", + # "I also started to use mroonga. It's also very fast! Really fast!", + # 1 + # ], + # [ + # "Good-bye Senna", + # "I migrated all Senna system!", + # 1 + # ], + # [ + # "Good-bye Tritonn", + # "I also migrated all Tritonn system!", + # 1 + # ] + # ] + # ] + # ] Modified: doc/source/reference/columns/vector.txt (+6 -0) =================================================================== --- doc/source/reference/columns/vector.txt 2014-03-10 16:39:17 +0900 (65e4601) +++ doc/source/reference/columns/vector.txt 2014-03-10 17:45:55 +0900 (f8397c6) @@ -39,6 +39,8 @@ There are three vector column types: This section describes how to use these types. +.. _normal-vector-column: + Normal vector column ^^^^^^^^^^^^^^^^^^^^ @@ -140,6 +142,8 @@ With :ref:`select-filter`: .. table_remove Tags .. table_remove Bookmarks +.. _reference-vector-column: + Reference vector column ^^^^^^^^^^^^^^^^^^^^^^^ @@ -164,6 +168,8 @@ How to search TODO +.. _weight-vector-column: + Weight vector column ^^^^^^^^^^^^^^^^^^^^ Modified: doc/source/reference/commands/select.txt (+99 -0) =================================================================== --- doc/source/reference/commands/select.txt 2014-03-10 16:39:17 +0900 (dc43480) +++ doc/source/reference/commands/select.txt 2014-03-10 17:45:55 +0900 (ff5a39d) @@ -42,6 +42,7 @@ Syntax [query_expansion=null] [query_flags=ALLOW_PRAGMA|ALLOW_COLUMN|ALLOW_UPDATE|ALLOW_LEADING_NOT|NONE] [query_expander=null] + [adjuster=null] Usage ----- @@ -838,6 +839,104 @@ TODO: write in English and add example. 検索結果をクエリキャッシュに残しません。キャッシュして再利用される可能性が低いクエリに対して用います。キャッシュ容量は有限です。有効なキャッシュが多くヒットするために、このパラメータは有効です。 +Score related parameters +^^^^^^^^^^^^^^^^^^^^^^^^ + +There is a score related parameter, ``adjuster``. + +.. _select-adjuster: + + +``adjuster`` +"""""""""""" + +It specifies one or more score adjust expressions. You need to use +``adjuster`` with ``query`` or ``filter``. ``adjuster`` doesn't work +with not searched request. + +You can increase score of specific records by ``adjuster``. You can +use ``adjuster`` to set high score for important records. + +For example, you can use ``adjuster`` to increase score of records +that have ``groonga`` tag. + +Here is the syntax:: + + --adjuster "SCORE_ADJUST_EXPRESSION1 + SCORE_ADJUST_EXPRESSION2 + ..." + +Here is the ``SCORE_ADJUST_EXPRESSION`` syntax:: + + COLUMN @ "KEYWORD" * WEIGHT + +Note the following: + + * ``COLUMN`` must be indexed. + * ``"KEYWORD"`` must be a string. + * ``WEIGHT`` must be a positive integer. + +Here is a sample ``adjuster`` usage example that uses just one +``SCORE_ADJUST_EXPRESSION``: + +.. groonga-command +.. include:: ../../example/reference/commands/select/adjuster_one.log +.. select Entries \ +.. --filter true \ +.. --adjuster 'content @ "groonga" * 5' \ +.. --output_columns _key,content,_score + +The ``select`` command matches all records. Then it applies +``adjuster``. The adjuster increases score of records that have +``"groonga"`` in ``Entries.content`` column by 5. There is only one +record that has ``"groonga"`` in ``Entries.content`` column. So the +record that its key is ``"Groonga"`` has score 6 (``= 1 + 5``). + +You can omit ``WEIGHT``. If you omit ``WEIGHT``, it is treated as 1. + +Here is a sample ``adjuster`` usage example that omits ``WEIGHT``: + +.. groonga-command +.. include:: ../../example/reference/commands/select/adjuster_no_weight.log +.. select Entries \ +.. --filter true \ +.. --adjuster 'content @ "groonga"' \ +.. --output_columns _key,content,_score + +The ``adjuster`` in the ``select`` command doesn't have ``WEIGHT``. So +the weight is treated as 1. There is only one record that has +``"groonga"`` in ``Entries.content`` column. So the record that its +key is ``"Groonga"`` has score 2 (``= 1 + 1``). + +Here is a sample ``adjuster`` usage example that uses multiple +``SCORE_ADJUST_EXPRESSION``: + +.. groonga-command +.. include:: ../../example/reference/commands/select/adjuster_multiple.log +.. select Entries \ +.. --filter true \ +.. --adjuster 'content @ "groonga" * 5 + content @ "started" * 3' \ +.. --output_columns _key,content,_score + +The ``adjuster`` in the ``select`` command has two +``SCORE_ADJUST_EXPRESSION`` s. The final score is sum of scores of +these ``SCORE_ADJUST_EXPRESSION`` s. All ``SCORE_ADJUST_EXPRESSION`` s +in the ``select`` command are applied to a record that its key is +``"Groonga"``. So the final score of the record is sum of scores of +all ``SCORE_ADJUST_EXPRESSION`` s. + +The first ``SCORE_ADJUST_EXPRESSION`` is ``content @ "groonga" * 5``. +It increases score by 5. + +The second ``SCORE_ADJUST_EXPRESSION`` is ``content @ "started" * 3``. +It increases score by 3. + +The final score is 9 (``= 1 + 5 + 3``). + +A ``SCORE_ADJUST_EXPRESSION`` has a weight for ``"KEYWORD"``. This +means that scores of all records that has ``"KEYWORD"`` are the same +value. You can change score for each record that has the same +``"KEYWORD"``. It is useful to tune search score. See +:ref:`weight-vector-column` for details. + 返値 ---- -------------- next part -------------- HTML����������������������������...Download