HAYASHI Kentaro
null+****@clear*****
Fri Mar 28 16:51:39 JST 2014
HAYASHI Kentaro 2014-03-28 16:51:39 +0900 (Fri, 28 Mar 2014) New Revision: 3ab774f154027b1717e89ea3ceacb8b370b746d7 https://github.com/groonga/groonga.org/commit/3ab774f154027b1717e89ea3ceacb8b370b746d7 Message: blog en: add 4.0.1 entry Added files: en/_posts/2014-03-29-release.textile Added: en/_posts/2014-03-29-release.textile (+183 -0) 100644 =================================================================== --- /dev/null +++ en/_posts/2014-03-29-release.textile 2014-03-28 16:51:39 +0900 (4aefe5d) @@ -0,0 +1,183 @@ +--- +layout: post.en +title: Groonga 4.0.1 has been released +description: Groonga 4.0.1 has been released! +published: false +--- + +h2. Groonga 4.0.1 has been released + +"Groonga 4.0.1":/docs/news.html#release-4-0-1 has been released! + +How to install: "Install":/docs/install.html + +There are following topics in this release. + +* Resolved incresing the size of database issue +* Supported weight vector column +* Supported adjuster option in select command + +h3. Resolved incresing the size of database issue + +In this release, Groonga has resolved that the size of database increase by updating. + +Here is the history of suppressing the size of database: + +* 3.1.0 - Added GRN_JA_SKIP_SAME_VALUE_PUT environment variable + + It skips updating database if the value is same. This feature is marked as experimental. + +* 3.1.2 - Enable GRN_JA_SKIP_SAME_VALUE_PUT=yes by default + + It forces to enable above flag by default because this feature is reasonable effects + to suppress the size of database. + +In contrast to previous approach, Groonga can manage to use variable length more effectively so It fixes the issue about incresing the size of database. + +Note that you need to recreate the database to suppress the size of database feature. + +Here is the summary: + +* You can open the database of previous versions by Groonga 4.0.1 or later. +* But, you can't open database which is created Groonga 4.0.1, by previous versions. +* You can use this feature by recreating the database. + +In fact, ongaeshi who is developer of "Milkode":http://milkode.ongaeshi.me/index.html had tested the impact of this feature. Here is the verified graph about incresing the size of database. (Thanks to ongaeshi!!!) + +<html> +<img src="http://d3j5vwomefv46c.cloudfront.net/photos/large/843929509.png?1394947803"/> +</html> + +It reveals the fact that if you use previous database as is(4.0.0-72-continue), the size of database just increases, but if you recreate database, you can suppress the size of one (4.0.0-72-new). + +h3. Supported weight vector column + +In the Groonga 4.0.1 release, vector column can store multiple pairs of key and value. It is weight vector column. + +For example, if you want to store user's attribute as tag, you need to use COLUMN_VECTOR as following: + +<pre> +column_create Users tags COLUMN_VECTOR ShortText +</pre> + +But, it is not enough if attribute has a deviation, so you need to use another columns to store the value of weight for each attriubutes as alternative way. (Here is the example schema definition of alternative way) + +<pre> +column_create Users tags COLUMN_VECTOR ShortText +column_create Users tags_A COLUMN_SCALAR Int32 +column_create Users tags_B COLUMN_SCALAR Int32 +column_create Users tags_C COLUMN_SCALAR Int32... +</pre> + +By supporting weight vector column, Groonga can unify such columns into one column. Use 'WITH_WEIGHT' flag in column definition. + +<pre> +column_create Users tags COLUMN_VECTOR|WITH_WEIGHT ShortText +</pre> + +You can store pair of key and value to vector column. + +<pre> +{"Tag A":weight1, "Tag B":weight2, "Tag C":weight3, ...} +</pre> + +h3. Supported adjuster option in select command + +In this release, Groonga supported adjuster option in select command. + +In the previous versions, you can treat weight for each column by using match_column. + +Here is the difference of match_column and adjuster option: + +* match_column - treat weight for matched column +* adjuster - treat weight for specific key of column + +In combination with weight vector column support, you can customize search results. + +For example, consiter to list up the person who use Groonga well. Assume that the value of rate is stored into weight vector column. + +Here is the sample schema definition: + +<pre> +table_create User TABLE_HASH_KEY ShortText +column_create User weight COLUMN_VECTOR|WITH_WEIGHT ShortText +column_create User tags COLUMN_VECTOR ShortText + +table_create Weight TABLE_HASH_KEY ShortText +column_create Weight weight_index COLUMN_INDEX|WITH_WEIGHT User weight + +table_create Tag TABLE_PAT_KEY ShortText +column_create Tag tags_index COLUMN_INDEX User tags +</pre> + +Here is the way to load sample data: + +<pre> +load --table User +[ + { + "_key":"alice", + "weight":{"Groonga":30, "Mroonga":20}, + "tags": ["Groonga", "Mroonga"] + }, + { + "_key":"bob", + "weight":{"Groonga":50}, + "tags": ["Groonga"] + }, + { + "_key":"carol", + "weight":{"Groonga":40,"Mroonga":30}, + "tags": ["Groonga", "Mroonga"] + } +] +</pre> + +In the simple way, you can just use filter option to get the person who use "Groonga". + +<pre> +select User --output_columns _key,_score,* --sortby -_score --filter 'tags @ "Groonga"' +</pre> + +But, we want to consider the rate in this case, so we need to use adjuster option for this purpose. + +<pre> +select User --output_columns _key,_score,* --sortby -_score --filter 'tags @ "Groonga"' --adjuster 'weight @ "Groonga" * 10' +</pre> + +Here is the parameter for adjuster: + +<pre> +'weight @ "Groonga" * 10' +</pre> + +It means that calculate the value of weight for weight column which use "Groonga" as keyword, if "Groonga" exists, multiply 10 for it. + +As a result, "bob" is the top of the result: + +<pre> +["bob",511,["Groonga"],{"Groonga":50}], +["carol",411,["Groonga","Mroonga"],{"Groonga":40,"Mroonga":30}], +["alice",311,["Groonga","Mroonga"],{"Groonga":30,"Mroonga":20}] +</pre> + +If you consider the person who use not only "Groonga" but also "Mroonga", specify "Mroonga" for adjuster: + +<pre> +select User --output_columns _key,_score,* --sortby -_score --filter 'tags @ "Groonga"' --adjuster 'weight @ "Mroonga" * 10' +</pre> + +As a result, "carol" is the top of the result: + +<pre> +["carol",311,["Groonga","Mroonga"],{"Groonga":40,"Mroonga":30}], +["alice",211,["Groonga","Mroonga"],{"Groonga":30,"Mroonga":20}], +["bob",1,["Groonga"],{"Groonga":50}] +</pre> + + +h3. Conclusion + +See "Release 3.1.2 2014/01/29":/docs/news.html#release-3-1-2 about detailed changes since 3.1.1. + +Let's search by Groonga! -------------- next part -------------- HTML����������������������������...Download