HAYASHI Kentaro
null+****@clear*****
Thu Mar 28 15:16:51 JST 2013
HAYASHI Kentaro 2013-03-28 15:16:51 +0900 (Thu, 28 Mar 2013) New Revision: 715fa23a229d3026478a838000ba66649ff2af13 https://github.com/groonga/groonga.github.com/commit/715fa23a229d3026478a838000ba66649ff2af13 Message: doc: add 3.0.2 release entry Added files: en/_posts/2013-03-29-release.textile Added: en/_posts/2013-03-29-release.textile (+208 -0) 100644 =================================================================== --- /dev/null +++ en/_posts/2013-03-29-release.textile 2013-03-28 15:16:51 +0900 (11d157a) @@ -0,0 +1,208 @@ +--- +layout: post.en +title: Groonga 3.0.2 has been released +description: Groonga 3.0.2 has been released! +published: true +--- + +h2. Groonga 3.0.2 has been released + +"Groonga 3.0.2":/docs/news.html#release-3-0-2 has been released! + +How to install: "Install":/docs/install.html + +There are two topics for this release. + +* Supported @sub_filter()@ function +* Supported query expander in @query()@ function + +h3. Supported @sub_filter()@ function + +In this release, @sub_filter()@ function has been supported. + +For example, we introduce the suitable case for @sub_filter()@ function. + +Here is the sample schema: + +<pre> + table_create Comment TABLE_PAT_KEY UInt32 + column_create Comment name COLUMN_SCALAR ShortText + column_create Comment content COLUMN_SCALAR ShortText + + table_create Blog TABLE_PAT_KEY ShortText + column_create Blog title COLUMN_SCALAR ShortText + column_create Blog content COLUMN_SCALAR ShortText + column_create Blog comments COLUMN_VECTOR Comment + + column_create Comment blog_comment_index COLUMN_INDEX Blog comments + + table_create Lexicon TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram + column_create Lexicon comment_content COLUMN_INDEX|WITH_POSITION Comment content + column_create Lexicon comment_name COLUMN_INDEX|WITH_POSITION Comment name + column_create Lexicon blog_content COLUMN_INDEX|WITH_POSITION Blog content +</pre> + +Blog table is related to Comment table. Lexicon table is created for full text search. + +Here are the sample data: + +<pre> + load --table Comment + [ + {"_key": 1, "name": "A", "content": "groonga"}, + {"_key": 2, "name": "B", "content": "groonga"}, + {"_key": 3, "name": "C", "content": "rroonga"}, + {"_key": 4, "name": "A", "content": "mroonga"}, + ] + + load --table Blog + [ + {"_key": "groonga's blog", "content": "content of groonga's blog", comments: [1, 2, 3]}, + {"_key": "mroonga's blog", "content": "content of mroonga's blog", comments: [2, 3, 4]}, + {"_key": "rroonga's blog", "content": "content of rroonga's blog", comments: [3]}, + ] +</pre> + +If you want to search blog entries that user "A" commented. +Here is the query for this purpose. + +<pre> + select Comment --output_columns _key,name,content --query "name:@\"A\"" + + [ + [2], + [ + ["_key","UInt32"],["name","ShortText"],["content","ShortText"] + ], + [1,"A","groonga"], + [4,"A","mroonga"] + ] +</pre> + +You know User "A" commented 'groonga' and 'mroonga'. + +Then, let's search the entries that user "A" commented about 'groonga'. At first, search the entries user "A"'s comment from Blog table. + +<pre> + select Blog --output_columns _key --filter "comments.name @ \"A\"" + + [ + [ + [2], + [["_key","ShortText"]], + ["groonga's blog"], + ["mroonga's blog"] + ] + ] +</pre> + +You know user "A" commented to "groonga's blog" and "mroonga's blog". + +Then, search the entries that user "A" commented about 'groonga'. +Here is the query which is added extra condition about 'groonga'. + +<pre> + select Blog --output_columns _key --filter "comments.name @ \"A\" && comments.content @ \"groonga\"" + + [ + [ + [2], + [["_key","ShortText"]], + ["groonga's blog"], + ["mroonga's blog"] + ] + ] +</pre> + +You know that the search results is same as before. +User "A" commented to "mroonga's blog", but not mentioned about "groonga". + +This is not the intended search results. + +What is the problem? + +The fact about following query: + +<pre>--filter "comment.name @ \"A\" && comment.content @ \"groonga\"</pre> + +* Are there entry matched to comment.name @ "A"? => Yes. there are comment of user "A". +* Are there entry matched to comment.content @ "groonga"? => Yes. there are entries matched to groonga. + +The both conditions above are met, "mroonga's blog" entry is regarded as matched entry. + +But, this is not intended results. + +We expect only "groonga's blog" is matched. + + �� sub_filter()@ function is used for this purpose. + +You can filter the results by comments context. + +Here is the example by using @sub_filter()@ function: + +<pre> + select Blog --output_columns _key \ + --filter 'sub_filter(comments, "name @ \\"A\\" && content @ \\"groonga\\"")' + + [ + [ + [1], + [["_key","ShortText"]], + ["groonga's blog"], + ] + ] +</pre> + +Confirm the results of above query. Now, you can search the Blog entry that user "A" commented about 'groonga'. + +h3. Supported query expander in @query()@ function + +This release began to support query expander in @query()@ function. + +The select command supports query expander and the keywords which has different weight to the column. +In 2.1.2 release, multiple @query()@ function had been supported, you can specify the different weight to the column each query. + +But, as @query()@ fuction doesn't support query expander functionality, you need to do query expansion by yourself if you want to search as same as @--query �� . + +In the previous release, @query()@ function syntax is: + +<pre> + query("MATCH_COLUMNS", "QUERY") +</pre> + +In this release, @query()@ function accepts 3rd argument: + +<pre> + query("MATCH_COLUMNS", "QUERY", "QueryExpanderTSV") +</pre> + +Now you can use with QueryExpanderTSV or the substitution table. + +See following documentation about "QueryExpanderTSV":http://groonga.org/docs/reference/query_expanders/tsv.html + +See following documentation about "substitution table":http://groonga.org/ja/docs/reference/commands/select.html#query-expander: + +As you know, the limitation that you need to use @--query@ if you want to use query expander and keywords which has different weight at once. + +Here is the query which returns the same results as substitution table: + +<pre> + select Users --match_columns "memo * 100" --query "memo:@groonga" \ + --query_expander Synonyms.synonym \ + --filter 'query("name * 10", "((...) OR (...) OR (...))")' +</pre> + +Here is the query which returns the same effects by using query expander +functionality introduced at this release: + +<pre> + select Users --match_columns "memo * 100" --query "memo:@groonga" \ + --query_expander Synonyms.synonym \ + --filter 'query("name * 10", "...", "Synonyms.synonym")' +</pre> + +h3. Conclusion + +See "Release 3.0.2 2013/03/29":/docs/news.html#release-3-0-2 about detailed changes since 3.0.1. + +Let's search by groonga! -------------- next part -------------- HTML����������������������������... Download