Feature #1075

selectの--sortbyで"緯度,経度"形式のGeoPointリテラルを指定できない

Added by Kouhei Sutou 8 months ago. Updated 4 months ago.

Status:新規 Start date:09/13/2011
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:1.3

Description

問題

selectで--sortby 'geo_distance(location, "35.68138194,139.766083888889")'と指定すると結果が0件になる。

ddl.grn:

table_create Shops TABLE_HASH_KEY ShortText
column_create Shops location COLUMN_SCALAR WGS84GeoPoint

table_create Locations TABLE_PAT_KEY WGS84GeoPoint
column_create Locations shop COLUMN_INDEX Shops location

shops.grn:

load --table Shops
[
["_key", "location"],
["根津のたいやき", "35.720253,139.762573"]
]

初期化:

% rm -rf /tmp/sortby-geo-test
% mkdir -p /tmp/sortby-geo-test
% cat ddl.grn shops.grn | groonga -n /tmp/sortby-geo-test/db
[[0,1315905087.59498,0.063490044],true]
[[0,1315905087.6586,0.055909422],true]
[[0,1315905087.7146,0.067834306],true]
[[0,1315905087.78252,0.152024251],true]
[[0,1315905087.9346,0.001940045],1]

「,」だと出力されない:

% groonga /tmp/sortby-geo-test/db
> > select Shops --sortby 'geo_distance(location, "35.68138194,139.766083888889")' --output_type xml
<?xml version="1.0" encoding="utf-8"?>
<SEGMENTS>
<SEGMENT>
<RESULTPAGE>
<RESULTSET OFFSET="0" LIMIT="1" NHITS="1">
</RESULTSET>
</RESULTPAGE>
</SEGMENT>
</SEGMENTS>

--sortbyを指定しないと出力される。

> select Shops --output_type xml
<?xml version="1.0" encoding="utf-8"?>
<SEGMENTS>
<SEGMENT>
<RESULTPAGE>
<RESULTSET OFFSET="0" LIMIT="1" NHITS="1">
<HIT NO="1">
<FIELD NAME="_id">1</FIELD>
<FIELD NAME="_key">根津のたいやき</FIELD>
<FIELD NAME="location">128592910x503145262</FIELD>
</HIT>
</RESULTSET>
</RESULTPAGE>
</SEGMENT>
</SEGMENTS>

「x」だと出力される:

> select Shops --sortby 'geo_distance(location, "35.68138194x139.766083888889")' --output_type xml
<?xml version="1.0" encoding="utf-8"?>
<SEGMENTS>
<SEGMENT>
<RESULTPAGE>
<RESULTSET OFFSET="0" LIMIT="1" NHITS="1">
<HIT NO="1">
<FIELD NAME="_id">1</FIELD>
<FIELD NAME="_key">根津のたいやき</FIELD>
<FIELD NAME="location">128592910x503145262</FIELD>
</HIT>
</RESULTSET>
</RESULTPAGE>
</SEGMENT>
</SEGMENTS>

期待する状態

「,」区切りでも「.」と同じように結果を出力する。

解決方法

db.c:tokenizeが「"..."」をサポートしていないのが問題な気がするので、tokenize()を改良して「"..."」もサポートするようにするのがいいと思う。

History

Updated by Kouhei Sutou 4 months ago

  • Target version changed from 1.2 to 1.3

Also available in: Atom PDF