null+****@clear*****
null+****@clear*****
2012年 5月 8日 (火) 17:49:20 JST
Kouhei Sutou 2012-05-08 17:49:20 +0900 (Tue, 08 May 2012) New Revision: 4d85d3b55cffff103f2ec052058195cd3acac556 Log: doc select: add description about match_escalation_threshold parameter Added files: doc/source/example/commands/select/match_escalation_threshold.log doc/source/tokenizers.txt Modified files: doc/source/commands/select.txt doc/source/reference.txt Modified: doc/source/commands/select.txt (+30 -6) =================================================================== --- doc/source/commands/select.txt 2012-05-08 16:40:35 +0900 (0c922b8) +++ doc/source/commands/select.txt 2012-05-08 17:49:20 +0900 (4859c4a) @@ -323,7 +323,7 @@ See :doc:`/spec/query_syntax` for other syntax. It can be used for not only fulltext search but also other conditions. For example, ``column:value`` means the value of -``column`` column equals to ``value``. ``column:<value`` means the +``column`` column is equal to ``value``. ``column:<value`` means the value of ``column`` column is less than ``value``. Here is a simple equality operator search example. @@ -358,7 +358,7 @@ both ``filter`` and ``query``. ``filter`` parameter is desgined for complex conditions. A filter text should be formated in :doc:`/spec/script_syntax`. The syntax is similar to ECMAScript. For example, ``column == "value"`` means that -the ``column`` column equals to ``"value"``. ``column < value`` means +the ``column`` column is equal to ``"value"``. ``column < value`` means that the value of ``column`` column is less than ``value``. Here is a simple equality operator search example. @@ -387,13 +387,11 @@ Advanced search parameters ``match_escalation_threshold`` """""""""""""""""""""""""""""" -TODO: add example. - It specifies threshold to determine whether search storategy escalation is used or not. The threshold is compared against the number of matched records. If the number of matched records is equal -to or less than the threshold, search storategy escalation is -used. See :doc:`/spec/search` about search storategy escalation. +to or less than the threshold, the search storategy escalation is +used. See :doc:`/spec/search` about the search storategy escalation. The default threshold is 0. It means that search storategy escalation is used only when no records are matched. @@ -405,6 +403,32 @@ The default threshold can be customized by one of the followings. * ``match-escalation-threshold`` configuration item in configuration file +Here is a simple ``match_escalation_threshold`` usage example. + +.. groonga-command +.. include:: ../example/commands/select/match_escalation_threshold.log +.. select Entries --match_columns content --query groo +.. select Entries --match_columns content --query groo --match_escalation_threshold -1 + +The first ``select`` command searches records that contain a word +``groo`` in ``content`` column value from ``Entries`` table. But no +records are matched because the ``TokenBigram`` tokenizer tokenizes +``groonga`` to ``groonga`` not ``gr|ro|oo|on|ng|ga``. (The +``TokenBigramSplitSymbolAlpha`` tokenizer tokenizes ``groonga`` to +``gr|ro|oo|on|ng|ga``. See :doc:`/tokenizers` for details.) It means +that ``groonga`` is indexed but ``groo`` isn't indexed. So no records +are matched against ``groo`` by exact match. In the case, the search +storategy escalation is used because the number of matched records (0) +is equal to ``match_escalation_threshold`` (0). One record is matched +against ``groo`` by unsplit search. + +The second ``select`` command also searches records that contain a +word ``groo`` in ``content`` column value from ``Entries`` table. And +it also doesn't found matched records. In this case, the search +storategy escalation is not used because the number of matched +records (0) is less than ``match_escalation_threshold`` (-1). So no +more searches aren't executed. And no records are matched. + ``query_expansion`` """"""""""""""""""" Added: doc/source/example/commands/select/match_escalation_threshold.log (+75 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/commands/select/match_escalation_threshold.log 2012-05-08 17:49:20 +0900 (9964cc7) @@ -0,0 +1,75 @@ +Execution example:: + + > select Entries --match_columns content --query groo + [ + [ + 0, + 1336466929.13937, + 0.000423669815063477 + ], + [ + [ + [ + 1 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "content", + "Text" + ], + [ + "n_likes", + "UInt32" + ] + ], + [ + 2, + "Groonga", + "I started to use groonga. It's very fast!", + 10 + ] + ] + ] + ] + > select Entries --match_columns content --query groo --match_escalation_threshold -1 + [ + [ + 0, + 1336466929.3408, + 0.00037693977355957 + ], + [ + [ + [ + 0 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "content", + "Text" + ], + [ + "n_likes", + "UInt32" + ] + ] + ] + ] + ] + \ No newline at end of file Modified: doc/source/reference.txt (+1 -0) =================================================================== --- doc/source/reference.txt 2012-05-08 16:40:35 +0900 (02d41f6) +++ doc/source/reference.txt 2012-05-08 17:49:20 +0900 (99f2d4d) @@ -12,6 +12,7 @@ output commands type + tokenizers pseudo_column expr functions Added: doc/source/tokenizers.txt (+8 -0) 100644 =================================================================== --- /dev/null +++ doc/source/tokenizers.txt 2012-05-08 17:49:20 +0900 (af7f1df) @@ -0,0 +1,8 @@ +.. -*- rst -*- + +.. highlightlang:: none + +Tokenizers +========== + +TODO: Write me.