diff --git a/doc/ja/source/commands/select.txt b/doc/ja/source/commands/select.txt index 42d58f5692..5e0d4d1b62 100644 --- a/doc/ja/source/commands/select.txt +++ b/doc/ja/source/commands/select.txt @@ -116,7 +116,7 @@ a - b ソートキーとなるカラム名のリストをカンマ(',')区切りで指定します。:: - [-]カラム名1 [-]カラム名2 [-]カラム名3... + [-]カラム名1, [-]カラム名2, [-]カラム名3, ... カラム名1の値でソートし、値が同一である場合はカラム名2でソート、と順次比較を行いソートします。カラム名の前に - を付加した場合は降順にソートします。付加しない場合には昇順にソートします。 @@ -126,7 +126,7 @@ a - b 出力するカラム名のリストをカンマ(',')区切りで指定します。 - アスタリスク('*')を指定すると、全てのカラムが指定されたものとみなされます。または、script形式のgrn_expr文字列を指定します。 (デフォルトは、'_id \*') + アスタリスク('*')を指定すると、全てのカラムが指定されたものとみなされます。または、script形式のgrn_expr文字列を指定します。 (デフォルトは、'_id, _key, \*') ``offset`` diff --git a/doc/ja/source/tutorial/tutorial01.txt b/doc/ja/source/tutorial/tutorial01.txt index f529727500..d1feb0e2d9 100644 --- a/doc/ja/source/tutorial/tutorial01.txt +++ b/doc/ja/source/tutorial/tutorial01.txt @@ -24,7 +24,7 @@ groongaのインストール前にMeCab (http://mecab.sourceforge.net/)をイン http://groonga.org/download/よりtar.gzファイルを取得し、 インストール先の環境にファイルを展開して、 :: - ./configure --prefix=/usr && make && sudo make install + ./configure --prefix=/usr --localstatedir=/var && make && sudo make install のように実行することでインストールできます。 diff --git a/lib/db.c b/lib/db.c index 61ee1ad8a4..fd55d9b4c6 100644 --- a/lib/db.c +++ b/lib/db.c @@ -3756,11 +3756,12 @@ grn_obj_is_persistent(grn_ctx *ctx, grn_obj *obj) GRN_BOOL_SET(ctx, dest, value_ < -DBL_EPSILON || DBL_EPSILON < value_);\ } +#define DEGREE_ACCURACY 10000000 + #define DEGREE2MSEC(degree)\ (((int)degree * 60 * 60 * 1000) +\ - (((int)(degree * 100) % 100) * 60 * 1000) +\ - (((int)(degree * 10000) % 100) * 1000) +\ - ((int)(degree * 10000000) % 1000)) + (((int)(degree * DEGREE_ACCURACY) % DEGREE_ACCURACY) * 60 / DEGREE_ACCURACY * 60 * 1000) +\ + (((int)(degree * DEGREE_ACCURACY) % DEGREE_ACCURACY) * 60 % DEGREE_ACCURACY * 60 / 10000)) grn_rc grn_obj_cast(grn_ctx *ctx, grn_obj *src, grn_obj *dest, int addp) diff --git a/lib/proc.c b/lib/proc.c index da69890c43..4c0c14f909 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -41,9 +41,9 @@ const char *grn_document_root = NULL; /**** procs ****/ #define DEFAULT_LIMIT 10 -#define DEFAULT_OUTPUT_COLUMNS "_id _key _value *" +#define DEFAULT_OUTPUT_COLUMNS "_id, _key, *" #define DEFAULT_DRILLDOWN_LIMIT 10 -#define DEFAULT_DRILLDOWN_OUTPUT_COLUMNS "_key _nsubrecs" +#define DEFAULT_DRILLDOWN_OUTPUT_COLUMNS "_key, _nsubrecs" #define LAP(msg,num) {\ uint64_t et;\ diff --git a/test/unit/core/test-cast-basic.c b/test/unit/core/test-cast-basic.c index f9b44f7537..4a1f1c281a 100644 --- a/test/unit/core/test-cast-basic.c +++ b/test/unit/core/test-cast-basic.c @@ -291,8 +291,8 @@ test_text_to_geo_point_in_degree(void) grn_obj_reinit(&context, &dest, GRN_DB_WGS84_GEO_POINT, 0); cast_text("35.6954581363924x139.564207350021"); GRN_GEO_POINT_VALUE(&dest, takane_latitude, takane_longitude); - cut_assert_equal_int(130194581, takane_latitude); - cut_assert_equal_int(503802073, takane_longitude); + cut_assert_equal_int(128503649, takane_latitude); + cut_assert_equal_int(502431146, takane_longitude); } void @@ -303,8 +303,8 @@ test_text_to_geo_point_in_degree_comma(void) grn_obj_reinit(&context, &dest, GRN_DB_WGS84_GEO_POINT, 0); cast_text("35.6954581363924,139.564207350021"); GRN_GEO_POINT_VALUE(&dest, takane_latitude, takane_longitude); - cut_assert_equal_int(130194581, takane_latitude); - cut_assert_equal_int(503802073, takane_longitude); + cut_assert_equal_int(128503649, takane_latitude); + cut_assert_equal_int(502431146, takane_longitude); } void @@ -324,7 +324,7 @@ test_text_to_geo_point_mixed(void) grn_obj_reinit(&context, &dest, GRN_DB_WGS84_GEO_POINT, 0); cast_text("35.6954581363924x503802073"); GRN_GEO_POINT_VALUE(&dest, takane_latitude, takane_longitude); - cut_assert_equal_int(130194581, takane_latitude); + cut_assert_equal_int(128503649, takane_latitude); cut_assert_equal_int(503802073, takane_longitude); } @@ -336,7 +336,7 @@ test_text_to_geo_point_mixed_comma(void) grn_obj_reinit(&context, &dest, GRN_DB_WGS84_GEO_POINT, 0); cast_text("35.6954581363924,503802073"); GRN_GEO_POINT_VALUE(&dest, takane_latitude, takane_longitude); - cut_assert_equal_int(130194581, takane_latitude); + cut_assert_equal_int(128503649, takane_latitude); cut_assert_equal_int(503802073, takane_longitude); } diff --git a/test/unit/core/test-inspect.c b/test/unit/core/test-inspect.c index 5dfefe7b80..86833d4c4b 100644 --- a/test/unit/core/test-inspect.c +++ b/test/unit/core/test-inspect.c @@ -352,10 +352,10 @@ test_geo_point_tokyo(void) geo_point_tokyo = grn_obj_open(context, GRN_BULK, 0, GRN_DB_TOKYO_GEO_POINT); GRN_GEO_POINT_SET(context, geo_point_tokyo, takane_latitude, takane_longitude); inspected = grn_inspect(context, NULL, geo_point_tokyo); - cut_assert_equal_string("[(130194581,503802073) " - "((36, 9, 54, 581),(139, 56, 42, 73)) " - "[00000001 01111110 10100000 00011101 " - "10010110 11100000 11010011 01100011]]", + cut_assert_equal_string("[(128503649,502431146) " + "((35, 41, 43, 649),(139, 33, 51, 146)) " + "[00000001 01111011 11011101 10000100 " + "10110101 11111011 01101100 01000110]]", inspected_string()); } @@ -370,10 +370,10 @@ test_geo_point_wgs84(void) geo_point_wgs84 = grn_obj_open(context, GRN_BULK, 0, GRN_DB_WGS84_GEO_POINT); GRN_GEO_POINT_SET(context, geo_point_wgs84, takane_latitude, takane_longitude); inspected = grn_inspect(context, NULL, geo_point_wgs84); - cut_assert_equal_string("[(130226900,503769900) " - "((36, 10, 26, 900),(139, 56, 9, 900)) " - "[00000001 01111110 10100000 00011110 " - "01010110 11001101 10100110 01110000]]", + cut_assert_equal_string("[(128515283,502419564) " + "((35, 41, 55, 283),(139, 33, 39, 564)) " + "[00000001 01111011 11011101 10000100 " + "10111011 10100000 10110110 01011010]]", inspected_string()); } diff --git a/test/unit/fixtures/story/taiyaki/ddl.grn b/test/unit/fixtures/story/taiyaki/ddl.grn index 78d9d0b051..0d33859eb5 100644 --- a/test/unit/fixtures/story/taiyaki/ddl.grn +++ b/test/unit/fixtures/story/taiyaki/ddl.grn @@ -17,6 +17,8 @@ column_create Shops tags COLUMN_VECTOR Tags column_create Shops location COLUMN_SCALAR WGS84GeoPoint column_create Shops latitude COLUMN_SCALAR Int32 column_create Shops longitude COLUMN_SCALAR Int32 +column_create Shops latitude_in_degree COLUMN_SCALAR Float +column_create Shops longitude_in_degree COLUMN_SCALAR FLoat column_create Shops categories COLUMN_VECTOR Categories column_create Shops area COLUMN_SCALAR Areas diff --git a/test/unit/fixtures/story/taiyaki/shops.grn b/test/unit/fixtures/story/taiyaki/shops.grn index d8c0aa8e90..283d4f2ff0 100644 --- a/test/unit/fixtures/story/taiyaki/shops.grn +++ b/test/unit/fixtures/story/taiyaki/shops.grn @@ -1,39 +1,39 @@ load --table Shops [ -{"_key":"nezu-no-taiyaki",name:"根津のたいやき","latitude":130322053,"longitude":504985073,"location":"130322053x504985073",tags:["たいやき","天然"],area:"area0005"}, -{"_key":"taiyaki-kataoka",name:"たい焼 カタオカ","latitude":130285021,"longitude":504715091,"location":"130285021x504715091",tags:["たいやき"]}, -{"_key":"soba-taiyaki-ku",name:"そばたいやき空","latitude":130117012,"longitude":504390088,"location":"130117012x504390088",tags:["たいやき"]}, -{"_key":"kuruma",name:"車","latitude":130335016,"longitude":504662007,"location":"130335016x504662007",tags:["たいやき"]}, -{"_key":"hirose-ya",name:"広瀬屋","latitude":130308044,"longitude":504536008,"location":"130308044x504536008",tags:["たいやき"]}, -{"_key":"sazare",name:"さざれ","latitude":130306053,"longitude":504530043,"location":"130306053x504530043",tags:["たいやき"]}, -{"_key":"omede-taiyaki",name:"おめで鯛焼き本舗錦糸町東急店","latitude":130205016,"longitude":505331054,"location":"130205016x505331054",tags:["たいやき"]}, -{"_key":"onaga-ya",name:"尾長屋 錦糸町店","latitude":130222054,"longitude":505270050,"location":"130222054x505270050",tags:["たいやき","白"]}, -{"_key":"shiro-ya",name:"たいやき工房白家 阿佐ヶ谷店","latitude":130255017,"longitude":504266011,"location":"130255017x504266011",tags:["たいやき","白"]}, -{"_key":"fuji-ya",name:"たいやき本舗 藤家 阿佐ヶ谷店","latitude":130239038,"longitude":504251015,"location":"130239038x504251015",tags:["たいやき","白"]}, -{"_key":"miyoshi",name:"みよし","latitude":129885039,"longitude":503653023,"location":"129885039x503653023",tags:["たいやき"]}, -{"_key":"juju-ya",name:"寿々屋 菓子","latitude":129809022,"longitude":504597055,"location":"129809022x504597055",tags:["たいやき"]}, -{"_key":"tatsumi-ya",name:"たい焼き \/ たつみや","latitude":130015001,"longitude":504266057,"location":"130015001x504266057",tags:["たいやき"]}, -{"_key":"tetsuji",name:"たい焼き鉄次 大丸東京店","latitude":130089012,"longitude":505045070,"location":"130089012x505045070",tags:["たいやき"],categories:["category0003","category0001"]}, -{"_key":"gazuma-ya",name:"吾妻屋","latitude":130208017,"longitude":504315098,"location":"130208017x504315098",tags:["たいやき"]}, -{"_key":"honma-mon",name:"ほんま門","latitude":130347036,"longitude":504325073,"location":"130347036x504325073",tags:["たこやき"],area:"area0014"}, -{"_key":"naniwa-ya",name:"浪花家","latitude":130380061,"longitude":505202034,"location":"130380061x505202034",tags:["たいやき","天然"]}, -{"_key":"kuro-dai",name:"代官山たい焼き黒鯛","latitude":129903045,"longitude":504648034,"location":"129903045x504648034",tags:["たいやき"]}, -{"_key":"daruma",name:"たいやき神田達磨 八重洲店","latitude":130094061,"longitude":505025099,"location":"130094061x505025099",tags:["たいやき"]}, -{"_key":"yanagi-ya",name:"柳屋 たい焼き","latitude":130133052,"longitude":505120058,"location":"130133052x505120058",tags:["たいやき","天然"],area:"area0002"}, -{"_key":"sharaku",name:"たい焼き写楽","latitude":130329069,"longitude":505188046,"location":"130329069x505188046",tags:["たいやき","天然"]}, -{"_key":"takane",name:"たかね 和菓子","latitude":130226001,"longitude":503769013,"location":"130226001x503769013",tags:["たいやき","天然","和菓子"]}, -{"_key":"chiyoda",name:"たい焼き ちよだ","latitude":129866001,"longitude":504328017,"location":"129866001x504328017",tags:["たいやき"]}, -{"_key":"da-ka-po",name:"ダ・カーポ","latitude":129786048,"longitude":504792049,"location":"129786048x504792049",tags:["たいやき","カレー"]}, -{"_key":"matsushima-ya",name:"松島屋","latitude":129845056,"longitude":504853081,"location":"129845056x504853081",tags:["和菓子"],categories:["和食"]}, -{"_key":"kazuya",name:"銀座 かずや","latitude":130055008,"longitude":504968095,"location":"130055008x504968095",tags:["和菓子"],categories:["和食"]}, -{"_key":"furuya-kogane-an",name:"ふるや古賀音庵 和菓子","latitude":130086003,"longitude":504480071,"location":"130086003x504480071",tags:["和菓子"],categories:["和食"]}, -{"_key":"hachi-no-ie",name:"蜂の家 自由が丘本店","latitude":129680021,"longitude":504441006,"location":"129680021x504441006",tags:["和菓子"],categories:["和食"]}, -{"_key":"azuki-chan",name:"薄皮たい焼き あづきちゃん","latitude":129855010,"longitude":504452003,"location":"129855010x504452003",tags:["たいやき"]}, -{"_key":"kuriko-an",name:"横浜 くりこ庵 浅草店","latitude":130280013,"longitude":505208029,"location":"130280013x505208029",tags:["たいやき"]}, -{"_key":"yume-no-aru-machi-no-taiyaki-ya-san",name:"夢ある街のたいやき屋さん戸越銀座店","latitude":129721099,"longitude":504685024,"location":"129721099x504685024",tags:["たいやき"]}, -{"_key":"naze-ya",name:"何故屋","latitude":129690039,"longitude":504418033,"location":"129690039x504418033",tags:["たいやき"]}, -{"_key":"sanoki-ya",name:"築地 さのきや","latitude":130019020,"longitude":505027021,"location":"130019020x505027021",tags:["たいやき","マグロ"],categories:"",area:"area0002"}, -{"_key":"shigeta",name:"しげ田","latitude":130046026,"longitude":505082073,"location":"130046026x505082073",tags:["たいやき","和菓子"],area:"area0002"}, -{"_key":"nishimi-ya",name:"にしみや 甘味処","latitude":130038025,"longitude":505066028,"location":"130038025x505066028",tags:["たいやき","おでん"]}, -{"_key":"hiiragi",name:"たいやきひいらぎ","latitude":129917001,"longitude":504675017,"location":"129917001x504675017",tags:["たいやき"],area:"area0013"} +{"_key":"nezu-no-taiyaki",name:"根津のたいやき","latitude":128592911,"longitude":503145263,"location":"128592911x503145263","latitude_in_degree":35.720253,"longitude_in_degree":139.762573,tags:["たいやき","天然"],area:"area0005"}, +{"_key":"taiyaki-kataoka",name:"たい焼 カタオカ","latitude":128565076,"longitude":502976128,"location":"128565076x502976128","latitude_in_degree":35.712521,"longitude_in_degree":139.715591,tags:["たいやき"]}, +{"_key":"soba-taiyaki-ku",name:"そばたいやき空","latitude":128461363,"longitude":502772717,"location":"128461363x502772717","latitude_in_degree":35.683712,"longitude_in_degree":139.659088,tags:["たいやき"]}, +{"_key":"kuruma",name:"車","latitude":128597458,"longitude":502942345,"location":"128597458x502942345","latitude_in_degree":35.721516,"longitude_in_degree":139.706207,tags:["たいやき"]}, +{"_key":"hirose-ya",name:"広瀬屋","latitude":128573438,"longitude":502868189,"location":"128573438x502868189","latitude_in_degree":35.714844,"longitude_in_degree":139.685608,tags:["たいやき"]}, +{"_key":"sazare",name:"さざれ","latitude":128572751,"longitude":502866155,"location":"128572751x502866155","latitude_in_degree":35.714653,"longitude_in_degree":139.685043,tags:["たいやき"]}, +{"_key":"omede-taiyaki",name:"おめで鯛焼き本舗錦糸町東急店","latitude":128521858,"longitude":503341754,"location":"128521858x503341754","latitude_in_degree":35.700516,"longitude_in_degree":139.817154,tags:["たいやき"]}, +{"_key":"onaga-ya",name:"尾長屋 錦糸町店","latitude":128513714,"longitude":503319780,"location":"128513714x503319780","latitude_in_degree":35.698254,"longitude_in_degree":139.811050,tags:["たいやき","白"]}, +{"_key":"shiro-ya",name:"たいやき工房白家 阿佐ヶ谷店","latitude":128539861,"longitude":502699000,"location":"128539861x502699000","latitude_in_degree":35.705517,"longitude_in_degree":139.638611,tags:["たいやき","白"]}, +{"_key":"fuji-ya",name:"たいやき本舗 藤家 阿佐ヶ谷店","latitude":128534177,"longitude":502693614,"location":"128534177x502693614","latitude_in_degree":35.703938,"longitude_in_degree":139.637115,tags:["たいやき","白"]}, +{"_key":"miyoshi",name:"みよし","latitude":128320340,"longitude":502334363,"location":"128320340x502334363","latitude_in_degree":35.644539,"longitude_in_degree":139.537323,tags:["たいやき"]}, +{"_key":"juju-ya",name:"寿々屋 菓子","latitude":128264119,"longitude":502904718,"location":"128264119x502904718","latitude_in_degree":35.628922,"longitude_in_degree":139.695755,tags:["たいやき"]}, +{"_key":"tatsumi-ya",name:"たい焼き \/ たつみや","latitude":128395804,"longitude":502699165,"location":"128395804x502699165","latitude_in_degree":35.665501,"longitude_in_degree":139.638657,tags:["たいやき"]}, +{"_key":"tetsuji",name:"たい焼き鉄次 大丸東京店","latitude":128451283,"longitude":503166852,"location":"128451283x503166852","latitude_in_degree":35.680912,"longitude_in_degree":139.768570,tags:["たいやき"],categories:["category0003","category0001"]}, +{"_key":"gazuma-ya",name:"吾妻屋","latitude":128522941,"longitude":502731353,"location":"128522941x502731353","latitude_in_degree":35.700817,"longitude_in_degree":139.647598,tags:["たいやき"]}, +{"_key":"honma-mon",name:"ほんま門","latitude":128601850,"longitude":502749263,"location":"128601850x502749263","latitude_in_degree":35.722736,"longitude_in_degree":139.652573,tags:["たこやき"],area:"area0014"}, +{"_key":"naniwa-ya",name:"浪花家","latitude":128628220,"longitude":503266442,"location":"128628220x503266442","latitude_in_degree":35.730061,"longitude_in_degree":139.796234,tags:["たいやき","天然"]}, +{"_key":"kuro-dai",name:"代官山たい焼き黒鯛","latitude":128341242,"longitude":502937402,"location":"128341242x502937402","latitude_in_degree":35.650345,"longitude_in_degree":139.704834,tags:["たいやき"]}, +{"_key":"daruma",name:"たいやき神田達磨 八重洲店","latitude":128453260,"longitude":503174156,"location":"128453260x503174156","latitude_in_degree":35.681461,"longitude_in_degree":139.770599,tags:["たいやき"]}, +{"_key":"yanagi-ya",name:"柳屋 たい焼き","latitude":128467228,"longitude":503222332,"location":"128467228x503222332","latitude_in_degree":35.685341,"longitude_in_degree":139.783981,tags:["たいやき","天然"],area:"area0002"}, +{"_key":"sharaku",name:"たい焼き写楽","latitude":128581088,"longitude":503261446,"location":"128581088x503261446","latitude_in_degree":35.716969,"longitude_in_degree":139.794846,tags:["たいやき","天然"]}, +{"_key":"takane",name:"たかね 和菓子","latitude":128514964,"longitude":502419287,"location":"128514964x502419287","latitude_in_degree":35.698601,"longitude_in_degree":139.560913,tags:["たいやき","天然","和菓子"]}, +{"_key":"chiyoda",name:"たい焼き ちよだ","latitude":128313364,"longitude":502750141,"location":"128313364x502750141","latitude_in_degree":35.642601,"longitude_in_degree":139.652817,tags:["たいやき"]}, +{"_key":"da-ka-po",name:"ダ・カーポ","latitude":128258446,"longitude":503018482,"location":"128258446x503018482","latitude_in_degree":35.627346,"longitude_in_degree":139.727356,tags:["たいやき","カレー"]}, +{"_key":"matsushima-ya",name:"松島屋","latitude":128306002,"longitude":503054572,"location":"128306002x503054572","latitude_in_degree":35.640556,"longitude_in_degree":139.737381,tags:["和菓子"],categories:["和食"]}, +{"_key":"kazuya",name:"銀座 かずや","latitude":128424629,"longitude":503139222,"location":"128424629x503139222","latitude_in_degree":35.673508,"longitude_in_degree":139.760895,tags:["和菓子"],categories:["和食"]}, +{"_key":"furuya-kogane-an",name:"ふるや古賀音庵 和菓子","latitude":128450171,"longitude":502833856,"location":"128450171x502833856","latitude_in_degree":35.680603,"longitude_in_degree":139.676071,tags:["和菓子"],categories:["和食"]}, +{"_key":"hachi-no-ie",name:"蜂の家 自由が丘本店","latitude":128188876,"longitude":502805182,"location":"128188876x502805182","latitude_in_degree":35.608021,"longitude_in_degree":139.668106,tags:["和菓子"],categories:["和食"]}, +{"_key":"azuki-chan",name:"薄皮たい焼き あづきちゃん","latitude":128309436,"longitude":502823531,"location":"128309436x502823531","latitude_in_degree":35.641510,"longitude_in_degree":139.673203,tags:["たいやき"]}, +{"_key":"kuriko-an",name:"横浜 くりこ庵 浅草店","latitude":128563247,"longitude":503268584,"location":"128563247x503268584","latitude_in_degree":35.712013,"longitude_in_degree":139.796829,tags:["たいやき"]}, +{"_key":"yume-no-aru-machi-no-taiyaki-ya-san",name:"夢ある街のたいやき屋さん戸越銀座店","latitude":128218316,"longitude":502965086,"location":"128218316x502965086","latitude_in_degree":35.616199,"longitude_in_degree":139.712524,tags:["たいやき"]}, +{"_key":"naze-ya",name:"何故屋","latitude":128192540,"longitude":502796999,"location":"128192540x502796999","latitude_in_degree":35.609039,"longitude_in_degree":139.665833,tags:["たいやき"]}, +{"_key":"sanoki-ya",name:"築地 さのきや","latitude":128397312,"longitude":503174596,"location":"128397312x503174596","latitude_in_degree":35.665920,"longitude_in_degree":139.770721,tags:["たいやき","マグロ"],categories:"",area:"area0002"}, +{"_key":"shigeta",name:"しげ田","latitude":128421454,"longitude":503208983,"location":"128421454x503208983","latitude_in_degree":35.672626,"longitude_in_degree":139.780273,tags:["たいやき","和菓子"],area:"area0002"}, +{"_key":"nishimi-ya",name:"にしみや 甘味処","latitude":128418570,"longitude":503188661,"location":"128418570x503188661","latitude_in_degree":35.671825,"longitude_in_degree":139.774628,tags:["たいやき","おでん"]}, +{"_key":"hiiragi",name:"たいやきひいらぎ","latitude":128331724,"longitude":502961461,"location":"128331724x502961461","latitude_in_degree":35.647701,"longitude_in_degree":139.711517,tags:["たいやき"],area:"area0013"} ] diff --git a/test/unit/lib/grn-test-utils.c b/test/unit/lib/grn-test-utils.c index 77b1e8a87b..fbee3c4678 100644 --- a/test/unit/lib/grn-test-utils.c +++ b/test/unit/lib/grn-test-utils.c @@ -735,15 +735,14 @@ grn_test_view_collect_string(grn_ctx *context, gint grn_test_coordinate_in_milliseconds(gdouble coordinate_in_degree) { - gint coordinate_in_milliseconds; + gint coordinate_in_milliseconds = 0; + gint accuracy = 10000000; + gint decimal_number; - coordinate_in_milliseconds = (gint)coordinate_in_degree * 60 * 60 * 1000; - coordinate_in_milliseconds += - ((gint)(coordinate_in_degree * 100) % 100) * 60 * 1000; - coordinate_in_milliseconds += - ((gint)(coordinate_in_degree * 10000) % 100) * 1000; - coordinate_in_milliseconds += - ((gint)(coordinate_in_degree * 10000000) % 1000); + coordinate_in_milliseconds += (gint)coordinate_in_degree * 60 * 60 * 1000; + decimal_number = ((gint)(coordinate_in_degree * accuracy) % accuracy) * 60; + coordinate_in_milliseconds += decimal_number / accuracy * 60 * 1000; + coordinate_in_milliseconds += decimal_number % accuracy * 60 / 10000; return coordinate_in_milliseconds; } @@ -751,10 +750,10 @@ grn_test_coordinate_in_milliseconds(gdouble coordinate_in_degree) gdouble grn_test_coordinate_in_degree(gint coordinate_in_milliseconds) { - gdouble coordinate_in_degree; + gdouble coordinate_in_degree = 0; - coordinate_in_degree = (coordinate_in_milliseconds % 1000) * 0.0000001; - coordinate_in_degree += coordinate_in_milliseconds / (gdouble)(1000 * 60 * 60); + coordinate_in_degree += (coordinate_in_milliseconds % 3600) * 0.0000001; + coordinate_in_degree += (coordinate_in_milliseconds / 3600.0) * 0.001; return coordinate_in_degree; } diff --git a/test/unit/story/test-taiyaki.c b/test/unit/story/test-taiyaki.c index 7888a784a2..0d3e5b84c4 100644 --- a/test/unit/story/test-taiyaki.c +++ b/test/unit/story/test-taiyaki.c @@ -103,15 +103,16 @@ test_in_circle(void) gint distance = 3 * 1000; cut_assert_equal_string( - "[[[6]," + "[[[7]," "[[\"name\",\"ShortText\"],[\"_score\",\"Int32\"]," "[\"location\",\"WGS84GeoPoint\"]]," - "[\"銀座 かずや\",795,\"130055008x504968095\"]," - "[\"たいやき神田達磨 八重洲店\",1079,\"130094061x505025099\"]," - "[\"たい焼き鉄次 大丸東京店\",1390,\"130089012x505045070\"]," - "[\"築地 さのきや\",1723,\"130019020x505027021\"]," - "[\"にしみや 甘味処\",2000,\"130038025x505066028\"]," - "[\"しげ田\",2272,\"130046026x505082073\"]" + "[\"銀座 かずや\",280,\"128424629x503139222\"]," + "[\"たい焼き鉄次 大丸東京店\",810,\"128451283x503166852\"]," + "[\"たいやき神田達磨 八重洲店\",970,\"128453260x503174156\"]," + "[\"にしみや 甘味処\",1056,\"128418570x503188661\"]," + "[\"築地 さのきや\",1186,\"128397312x503174596\"]," + "[\"しげ田\",1530,\"128421454x503208983\"]," + "[\"柳屋 たい焼き\",2179,\"128467228x503222332\"]" "]]", send_command( cut_take_printf( @@ -139,9 +140,9 @@ test_in_rectangle_long_longitude(void) "[[[3]," "[[\"name\",\"ShortText\"],[\"_score\",\"Int32\"]," "[\"location\",\"WGS84GeoPoint\"]]," - "[\"たいやき神田達磨 八重洲店\",3273,\"130094061x505025099\"]," - "[\"銀座 かずや\",3713,\"130055008x504968095\"]," - "[\"たい焼き鉄次 大丸東京店\",3732,\"130089012x505045070\"]" + "[\"たい焼き鉄次 大丸東京店\",2186,\"128451283x503166852\"]," + "[\"たいやき神田達磨 八重洲店\",2296,\"128453260x503174156\"]," + "[\"銀座 かずや\",2415,\"128424629x503139222\"]" "]]", send_command( cut_take_printf( @@ -167,13 +168,14 @@ test_in_rectangle_long_latitude(void) gdouble budoukan_longitude = 139.74968; cut_assert_equal_string( - "[[[4]," + "[[[5]," "[[\"name\",\"ShortText\"],[\"_score\",\"Int32\"]," "[\"location\",\"WGS84GeoPoint\"]]," - "[\"たいやき神田達磨 八重洲店\",3273,\"130094061x505025099\"]," - "[\"銀座 かずや\",3713,\"130055008x504968095\"]," - "[\"根津のたいやき\",4754,\"130322053x504985073\"]," - "[\"築地 さのきや\",5244,\"130019020x505027021\"]" + "[\"たい焼き鉄次 大丸東京店\",2186,\"128451283x503166852\"]," + "[\"たいやき神田達磨 八重洲店\",2296,\"128453260x503174156\"]," + "[\"銀座 かずや\",2415,\"128424629x503139222\"]," + "[\"根津のたいやき\",3210,\"128592911x503145263\"]," + "[\"築地 さのきや\",3579,\"128397312x503174596\"]" "]]", send_command( cut_take_printf( @@ -195,14 +197,15 @@ test_sort(void) gint distance = 3 * 1000; cut_assert_equal_string( - "[[[6]," + "[[[7]," "[[\"name\",\"ShortText\"],[\"_score\",\"Int32\"]]," - "[\"銀座 かずや\",795]," - "[\"たいやき神田達磨 八重洲店\",1079]," - "[\"たい焼き鉄次 大丸東京店\",1390]," - "[\"築地 さのきや\",1723]," - "[\"にしみや 甘味処\",2000]," - "[\"しげ田\",2272]" + "[\"銀座 かずや\",280]," + "[\"たい焼き鉄次 大丸東京店\",810]," + "[\"たいやき神田達磨 八重洲店\",970]," + "[\"にしみや 甘味処\",1056]," + "[\"築地 さのきや\",1186]," + "[\"しげ田\",1530]," + "[\"柳屋 たい焼き\",2179]" "]]", send_command( cut_take_printf( @@ -226,16 +229,16 @@ test_filter_by_tag_and_sort_by_distance_from_tokyo_tocho(void) cut_assert_equal_string( "[[[31]," "[[\"name\",\"ShortText\"],[\"_score\",\"Int32\"]]," - "[\"さざれ\",4110]," - "[\"広瀬屋\",4149]," - "[\"そばたいやき空\",4507]," - "[\"たい焼 カタオカ\",5210]," - "[\"車\",5600]," - "[\"吾妻屋\",6099]," - "[\"たいやき工房白家 阿佐ヶ谷店\",7646]," - "[\"たいやき本舗 藤家 阿佐ヶ谷店\",7861]," - "[\"たいやきひいらぎ\",8463]," - "[\"代官山たい焼き黒鯛\",8668]" + "[\"さざれ\",2860]," + "[\"広瀬屋\",2870]," + "[\"そばたいやき空\",3004]," + "[\"たい焼 カタオカ\",3347]," + "[\"車\",3792]," + "[\"吾妻屋\",4166]," + "[\"代官山たい焼き黒鯛\",4497]," + "[\"たいやきひいらぎ\",4965]," + "[\"たいやき工房白家 阿佐ヶ谷店\",5102]," + "[\"たいやき本舗 藤家 阿佐ヶ谷店\",5171]" "]]", send_command( cut_take_printf( @@ -252,14 +255,16 @@ test_in_circle_and_tag(void) { gdouble tokyo_tocho_latitude = 35.689444; gdouble tokyo_tocho_longitude = 139.691667; - gint distance = 5 * 1000; + gint distance = 4 * 1000; cut_assert_equal_string( - "[[[3]," + "[[[5]," "[[\"name\",\"ShortText\"],[\"_score\",\"Int32\"]]," - "[\"さざれ\",4110]," - "[\"広瀬屋\",4150]," - "[\"そばたいやき空\",4524]" + "[\"さざれ\",2860]," + "[\"広瀬屋\",2871]," + "[\"そばたいやき空\",3016]," + "[\"たい焼 カタオカ\",3353]," + "[\"車\",3794]" "]]", send_command( cut_take_printf( @@ -278,16 +283,16 @@ test_but_white(void) { gdouble asagaya_latitude = 35.70452; gdouble asagaya_longitude = 139.6351; - gint distance = 10 * 1000; + gint distance = 5 * 1000; cut_assert_equal_string( "[[[5]," "[[\"name\",\"ShortText\"],[\"_score\",\"Int32\"]]," - "[\"吾妻屋\",2385]," - "[\"そばたいやき空\",5592]," - "[\"たい焼き / たつみや\",7148]," - "[\"さざれ\",7671]," - "[\"広瀬屋\",7830]" + "[\"吾妻屋\",1198]," + "[\"そばたいやき空\",3162]," + "[\"たい焼き / たつみや\",4341]," + "[\"さざれ\",4637]," + "[\"広瀬屋\",4692]" "]]", send_command( cut_take_printf( @@ -311,27 +316,28 @@ test_drilldown(void) gint distance = 10 * 1000; cut_assert_equal_string( - "[[[13]," + "[[[23]," "[[\"name\",\"ShortText\"],[\"_score\",\"Int32\"]]," - "[\"たいやき神田達磨 八重洲店\",1079]," - "[\"たい焼き鉄次 大丸東京店\",1390]," - "[\"築地 さのきや\",1723]," - "[\"にしみや 甘味処\",2000]," - "[\"しげ田\",2272]," - "[\"柳屋 たい焼き\",3686]," - "[\"根津のたいやき\",7812]," - "[\"尾長屋 錦糸町店\",8314]," - "[\"横浜 くりこ庵 浅草店\",8394]," - "[\"たいやきひいらぎ\",9242]]," - "[[6]," + "[\"たい焼き鉄次 大丸東京店\",810]," + "[\"たいやき神田達磨 八重洲店\",970]," + "[\"にしみや 甘味処\",1056]," + "[\"築地 さのきや\",1186]," + "[\"しげ田\",1530]," + "[\"柳屋 たい焼き\",2179]," + "[\"尾長屋 錦糸町店\",5007]," + "[\"根津のたいやき\",5036]," + "[\"横浜 くりこ庵 浅草店\",5098]," + "[\"たい焼き写楽\",5457]]," + "[[7]," "[[\"_key\",\"ShortText\"]," "[\"name\",\"ShortText\"]," "[\"_nsubrecs\",\"Int32\"]]," "[\"おでん\",\"\",1]," - "[\"たいやき\",\"\",13]," + "[\"たいやき\",\"\",23]," + "[\"カレー\",\"\",1]," "[\"マグロ\",\"\",1]," "[\"和菓子\",\"\",1]," - "[\"天然\",\"\",3]," + "[\"天然\",\"\",4]," "[\"白\",\"\",1]]," "[[2]," "[[\"_key\",\"ShortText\"]," @@ -372,18 +378,18 @@ test_drilldown_with_broken_reference(void) assert_send_commands("delete Areas area0002"); assert_send_commands("delete Areas area0005"); cut_assert_equal_string( - "[[[13]," + "[[[23]," "[[\"name\",\"ShortText\"],[\"_score\",\"Int32\"]]," - "[\"たいやき神田達磨 八重洲店\",1081]," - "[\"たい焼き鉄次 大丸東京店\",1395]," - "[\"築地 さのきや\",1725]," - "[\"にしみや 甘味処\",2007]," - "[\"しげ田\",2281]," - "[\"柳屋 たい焼き\",3698]," - "[\"根津のたいやき\",7813]," - "[\"尾長屋 錦糸町店\",8339]," - "[\"横浜 くりこ庵 浅草店\",8409]," - "[\"たいやきひいらぎ\",9273]]," + "[\"たい焼き鉄次 大丸東京店\",811]," + "[\"たいやき神田達磨 八重洲店\",972]," + "[\"にしみや 甘味処\",1060]," + "[\"築地 さのきや\",1187]," + "[\"しげ田\",1537]," + "[\"柳屋 たい焼き\",2186]," + "[\"尾長屋 錦糸町店\",5024]," + "[\"根津のたいやき\",5036]," + "[\"横浜 くりこ庵 浅草店\",5106]," + "[\"たい焼き写楽\",5464]]," "[[1]," "[[\"_key\",\"ShortText\"]," "[\"name\",\"ShortText\"]," @@ -413,22 +419,23 @@ test_weight_match(void) gint distance = 10 * 1000; cut_assert_equal_string( - "[[[13]," + "[[[23]," "[[\"name\",\"ShortText\"],[\"_score\",\"Int32\"]]," - "[\"たいやき神田達磨 八重洲店\",9922]," - "[\"たい焼き鉄次 大丸東京店\",8611]," - "[\"築地 さのきや\",8278]," - "[\"にしみや 甘味処\",8001]," - "[\"しげ田\",7729]," - "[\"柳屋 たい焼き\",6315]," - "[\"たいやきひいらぎ\",1759]," - "[\"尾長屋 錦糸町店\",1687]," - "[\"横浜 くりこ庵 浅草店\",1607]," - "[\"たい焼き写楽\",651]]," - "[[6]," + "[\"たいやき神田達磨 八重洲店\",10031]," + "[\"たい焼き鉄次 大丸東京店\",9191]," + "[\"にしみや 甘味処\",8945]," + "[\"築地 さのきや\",8815]," + "[\"しげ田\",8471]," + "[\"柳屋 たい焼き\",7822]," + "[\"たいやきひいらぎ\",5428]," + "[\"尾長屋 錦糸町店\",4994]," + "[\"横浜 くりこ庵 浅草店\",4903]," + "[\"たい焼き写楽\",4544]]," + "[[7]," "[[\"_key\",\"ShortText\"],[\"_nsubrecs\",\"Int32\"]]," - "[\"たいやき\",13]," - "[\"天然\",3]," + "[\"たいやき\",23]," + "[\"天然\",4]," + "[\"カレー\",1]," "[\"白\",1]," "[\"マグロ\",1]," "[\"和菓子\",1],"