null+****@clear*****
null+****@clear*****
2012年 7月 9日 (月) 13:29:29 JST
Kouhei Sutou 2012-07-09 13:29:29 +0900 (Mon, 09 Jul 2012) New Revision: 9dc6d245da30089e7cd331f3cc007610a6a687c0 https://github.com/groonga/groonga/commit/9dc6d245da30089e7cd331f3cc007610a6a687c0 Log: doc: update suffix search description Suffix search doesn't support non-ASCII characters. Modified files: doc/source/example/reference/grn_expr/query_syntax/simple_suffix_search.log doc/source/example/reference/grn_expr/script_syntax/simple_suffix_search_operator.log doc/source/reference/grn_expr/query_syntax.txt doc/source/reference/grn_expr/script_syntax.txt Modified: doc/source/example/reference/grn_expr/query_syntax/simple_suffix_search.log (+17 -12) =================================================================== --- doc/source/example/reference/grn_expr/query_syntax/simple_suffix_search.log 2012-07-09 13:27:47 +0900 (b2f340d) +++ doc/source/example/reference/grn_expr/query_syntax/simple_suffix_search.log 2012-07-09 13:29:29 +0900 (674f03e) @@ -1,17 +1,22 @@ Execution example:: - table_create Titles TABLE_PAT_KEY ShortText + table_create Titles TABLE_NO_KEY + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Titles content COLUMN_SCALAR ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + table_create SuffixSearchTerms TABLE_PAT_KEY|KEY_WITH_SIS ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create SuffixSearchTerms index COLUMN_INDEX Titles content # [[0, 1337566253.89858, 0.000355720520019531], true] load --table Titles [ - {"_key": "The first post!"}, - {"_key": "Groonga"}, - {"_key": "Mroonga"}, - {"_key": "Good-bye Senna"}, - {"_key": "Good-bye Tritonn"} + {"content": "ぐるんが"}, + {"content": "むるんが"}, + {"content": "せな"}, + {"content": "とりとん"} ] - # [[0, 1337566253.89858, 0.000355720520019531], 5] - select Titles --query '_key:$oonga' + # [[0, 1337566253.89858, 0.000355720520019531], 4] + select Titles --query 'content:$んが' # [ # [ # 0, @@ -29,17 +34,17 @@ Execution example:: # "UInt32" # ], # [ - # "_key", + # "content", # "ShortText" # ] # ], # [ # 2, - # "Groonga" + # "むるんが" # ], # [ - # 3, - # "Mroonga" + # 1, + # "ぐるんが" # ] # ] # ] Modified: doc/source/example/reference/grn_expr/script_syntax/simple_suffix_search_operator.log (+22 -11) =================================================================== --- doc/source/example/reference/grn_expr/script_syntax/simple_suffix_search_operator.log 2012-07-09 13:27:47 +0900 (e199ce1) +++ doc/source/example/reference/grn_expr/script_syntax/simple_suffix_search_operator.log 2012-07-09 13:29:29 +0900 (674f03e) @@ -1,17 +1,22 @@ Execution example:: - table_create Titles TABLE_PAT_KEY ShortText + table_create Titles TABLE_NO_KEY + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Titles content COLUMN_SCALAR ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + table_create SuffixSearchTerms TABLE_PAT_KEY|KEY_WITH_SIS ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create SuffixSearchTerms index COLUMN_INDEX Titles content # [[0, 1337566253.89858, 0.000355720520019531], true] load --table Titles [ - {"_key": "The first post!"}, - {"_key": "Groonga"}, - {"_key": "Mroonga"}, - {"_key": "Good-bye Senna"}, - {"_key": "Good-bye Tritonn"} + {"content": "ぐるんが"}, + {"content": "むるんが"}, + {"content": "せな"}, + {"content": "とりとん"} ] - # [[0, 1337566253.89858, 0.000355720520019531], 5] - select Titles --filter '_key @$ "oonga"' --output_columns _key + # [[0, 1337566253.89858, 0.000355720520019531], 4] + select Titles --query 'content:$んが' # [ # [ # 0, @@ -25,15 +30,21 @@ Execution example:: # ], # [ # [ - # "_key", + # "_id", + # "UInt32" + # ], + # [ + # "content", # "ShortText" # ] # ], # [ - # "Groonga" + # 2, + # "むるんが" # ], # [ - # "Mroonga" + # 1, + # "ぐるんが" # ] # ] # ] Modified: doc/source/reference/grn_expr/query_syntax.txt (+26 -20) =================================================================== --- doc/source/reference/grn_expr/query_syntax.txt 2012-07-09 13:27:47 +0900 (5ef23ac) +++ doc/source/reference/grn_expr/query_syntax.txt 2012-07-09 13:29:29 +0900 (1e84d8f) @@ -277,17 +277,21 @@ Its syntax is ``column:$value``. This conditional expression does suffix search with ``value``. Suffix search searches records that contain a word that ends with ``value``. -To use fast suffix search, you need to use patricia trie table -(``TABLE_PAT_KEY``) with ``KEY_WITH_SIS`` flag. You can also use fast -suffix search against ``_key`` value of patricia trie table. +To use fast suffix search, you need to define an index column whose +table is patricia trie table (``TABLE_PAT_KEY``) with ``KEY_WITH_SIS`` +flag. You can also use fast suffix search against ``_key`` pseudo +column whose table is patricia trie table (``TABLE_PAT_KEY``) with +``KEY_WITH_SIS`` flag without index column. We recommended that you +use index column based fast suffix search instead of ``_key`` based +fast suffix search. ``_key`` based fast suffix search returnes +automatically registered substrings. (TODO: write document about +suffix search and link to it from here.) .. note:: - You can use ``KEY_WITH_SIS`` based fast suffix search for non-ASCII - characters such as Japanese but cannot use it for ASCII - characters. You need to use ``_key`` based fast suffix search - instead of ``KEY_WITH_SIS`` based fast suffix search for ASCII - characters. + Fast suffix search can be used only for non-ASCII characters such + as hiragana in Japanese. You cannot use fast suffix search for + ASCII character. Suffix search can be used with other table types or patricia trie table without ``KEY_WITH_SIS`` flag but it causes all records @@ -297,25 +301,27 @@ large records. It doesn't require the default match columns such as ``full text search condition`` and ``phrase search condition``. -Here is a simple exmaple. It uses ``_key`` based fast suffix search -not ``KEY_WITH_SIS`` based fast suffix search. +Here is a simple exmaple. It uses fast suffix search for hiragana in +Japanese that is one of non-ASCII characters. .. groonga-command .. include:: ../../example/reference/grn_expr/query_syntax/simple_suffix_search.log -.. table_create Titles TABLE_PAT_KEY ShortText +.. table_create Titles TABLE_NO_KEY +.. column_create Titles content COLUMN_SCALAR ShortText +.. table_create SuffixSearchTerms TABLE_PAT_KEY|KEY_WITH_SIS ShortText +.. column_create SuffixSearchTerms index COLUMN_INDEX Titles content .. load --table Titles .. [ -.. {"_key": "The first post!"}, -.. {"_key": "Groonga"}, -.. {"_key": "Mroonga"}, -.. {"_key": "Good-bye Senna"}, -.. {"_key": "Good-bye Tritonn"} +.. {"content": "ぐるんが"}, +.. {"content": "むるんが"}, +.. {"content": "せな"}, +.. {"content": "とりとん"} .. ] -.. select Titles --query '_key:$oonga' +.. select Titles --query 'content:$んが' -The expression matches records that contain a word that ends with -``oonga`` in ``_key`` pseudo column value. ``Groonga`` and ``Mroonga`` -are matched with the expression. +The expression matches records that have value that ends with ``んが`` +in ``content`` column value. ``ぐるんが`` and ``むるんが`` are matched +with the expression. Equal condition ^^^^^^^^^^^^^^^ Modified: doc/source/reference/grn_expr/script_syntax.txt (+26 -20) =================================================================== --- doc/source/reference/grn_expr/script_syntax.txt 2012-07-09 13:27:47 +0900 (8eaddce) +++ doc/source/reference/grn_expr/script_syntax.txt 2012-07-09 13:29:29 +0900 (67c0d72) @@ -214,42 +214,48 @@ Its syntax is ``column @$ value``. This operator does suffix search with ``value``. Suffix search searches records that contain a word that ends with ``value``. -To use fast suffix search, you need to use patricia trie table -(``TABLE_PAT_KEY``) with ``KEY_WITH_SIS`` flag. You can also use fast -suffix search against ``_key`` value of patricia trie table. +To use fast suffix search, you need to define an index column whose +table is patricia trie table (``TABLE_PAT_KEY``) with ``KEY_WITH_SIS`` +flag. You can also use fast suffix search against ``_key`` pseudo +column whose table is patricia trie table (``TABLE_PAT_KEY``) with +``KEY_WITH_SIS`` flag without index column. We recommended that you +use index column based fast suffix search instead of ``_key`` based +fast suffix search. ``_key`` based fast suffix search returnes +automatically registered substrings. (TODO: write document about +suffix search and link to it from here.) .. note:: - You can use ``KEY_WITH_SIS`` based fast suffix search for non-ASCII - characters such as Japanese but cannot use it for ASCII - characters. You need to use ``_key`` based fast suffix search - instead of ``KEY_WITH_SIS`` based fast suffix search for ASCII - characters. + Fast suffix search can be used only for non-ASCII characters such + as hiragana in Japanese. You cannot use fast suffix search for + ASCII character. Suffix search can be used with other table types or patricia trie table without ``KEY_WITH_SIS`` flag but it causes all records scan. It's not problem for small records but it spends more time for large records. -Here is a simple exmaple. It uses ``_key`` based fast suffix search -not ``KEY_WITH_SIS`` based fast suffix search. +Here is a simple exmaple. It uses fast suffix search for hiragana in +Japanese that is one of non-ASCII characters. .. groonga-command .. include:: ../../example/reference/grn_expr/script_syntax/simple_suffix_search_operator.log -.. table_create Titles TABLE_PAT_KEY ShortText +.. table_create Titles TABLE_NO_KEY +.. column_create Titles content COLUMN_SCALAR ShortText +.. table_create SuffixSearchTerms TABLE_PAT_KEY|KEY_WITH_SIS ShortText +.. column_create SuffixSearchTerms index COLUMN_INDEX Titles content .. load --table Titles .. [ -.. {"_key": "The first post!"}, -.. {"_key": "Groonga"}, -.. {"_key": "Mroonga"}, -.. {"_key": "Good-bye Senna"}, -.. {"_key": "Good-bye Tritonn"} +.. {"content": "ぐるんが"}, +.. {"content": "むるんが"}, +.. {"content": "せな"}, +.. {"content": "とりとん"} .. ] -.. select Titles --filter '_key @$ "oonga"' --output_columns _key +.. select Titles --query 'content:$んが' -The expression matches records that contain a word that ends with -``oonga`` in ``_key`` pseudo column value. ``Groonga`` and ``Mroonga`` -are matched with the expression. +The expression matches records that have value that ends with ``んが`` +in ``content`` column value. ``ぐるんが`` and ``むるんが`` are matched +with the expression. Near search opeorator ^^^^^^^^^^^^^^^^^^^^^ -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...Download