Skip to content

Commit

Permalink
doc: change the geo_distance example
Browse files Browse the repository at this point in the history
Tokyo to Sapporo->
New York City to London
  • Loading branch information
kenhys committed Aug 1, 2012
1 parent 4ad2b11 commit 6c59bfc
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Execution example::

select Geo --output_columns distance --scorer 'distance = geo_distance("128452975x503157902", "155047000x508862800", "rectangle")'
select Geo --output_columns distance --scorer 'distance = geo_distance("146566000x-266422000", "185428000x-461000", "rectangle")'
# [
# [
# 0,
Expand All @@ -19,7 +19,7 @@ Execution example::
# ]
# ],
# [
# 830849
# 5807750
# ]
# ]
# ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Execution example::

select Stations --output_columns _score --filter 1 --scorer '_score = geo_distance(location, "155047000x508862800", "ellipsoid")'
select Cities --output_columns _score --filter 1 --scorer '_score = geo_distance(location, "185428000x-461000", "ellipsoid")'
# [
# [
# 0,
Expand All @@ -19,7 +19,7 @@ Execution example::
# ]
# ],
# [
# 15400284
# 5706263
# ]
# ]
# ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Execution example::

select Stations --output_columns _score --filter 1 --scorer '_score = geo_distance(location, "155047000x508862800", "rectangle")'
select Cities --output_columns _score --filter 1 --scorer '_score = geo_distance(location, "185428000x-461000", "rectangle")'
# [
# [
# 0,
Expand All @@ -19,7 +19,7 @@ Execution example::
# ]
# ],
# [
# 15351658
# 5715104
# ]
# ]
# ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Execution example::

select Stations --output_columns _score --filter 1 --scorer '_score = geo_distance(location, "155047000x508862800", "sphere")'
select Cities --output_columns _score --filter 1 --scorer '_score = geo_distance(location, "185428000x-461000", "sphere")'
# [
# [
# 0,
Expand All @@ -19,7 +19,7 @@ Execution example::
# ]
# ],
# [
# 13845929
# 5715102
# ]
# ]
# ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Execution example::

table_create Stations TABLE_HASH_KEY ShortText
table_create Cities TABLE_HASH_KEY ShortText
# [[0, 1337566253.89858, 0.000355720520019531], true]
column_create Stations location COLUMN_SCALAR WGS84GeoPoint
column_create Cities location COLUMN_SCALAR WGS84GeoPoint
# [[0, 1337566253.89858, 0.000355720520019531], true]
load --table Stations
load --table Cities
[
{
"_key", "location"
},
{
"Tokyo", "128452975x503157902"
"New York City", "146566000x-266422000",
},
]
# [[0, 1337566253.89858, 0.000355720520019531], 1]
40 changes: 20 additions & 20 deletions doc/source/reference/functions/geo_distance.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,58 +50,58 @@ Lets's learn about ``geo_distance`` usage with examples.
This section shows simple usages.

Here are two schema definition and sample data to show the difference according to the usage.
Those samples show how to calculate the value of distance between Tokyo and Sapporo.
Those samples show how to calculate the value of distance between New York City and London.

#. Using the column value of location for calculating the distance (``Stations`` table)
#. Using the column value of location for calculating the distance (``Cities`` table)
#. Using the explicitly specified coordinates for calculating the distance (``Geo`` table)

Using the column value of location
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Here are a schema definition of ``Stations`` table and sample data to show usage.
Here are a schema definition of ``Cities`` table and sample data to show usage.

::

table_create Stations TABLE_HASH_KEY ShortText
column_create Stations location COLUMN_SCALAR WGS84GeoPoint
load --table Stations
table_create Cities TABLE_HASH_KEY ShortText
column_create Cities location COLUMN_SCALAR WGS84GeoPoint
load --table Cities
[
{
"_key", "location"
},
{
"Tokyo", "128452975x503157902"
"New York City", "146566000x-266422000",
},
]

.. groonga-command
.. include:: ../../example/reference/functions/geo_distance_setup_location.log
.. table_create Stations TABLE_HASH_KEY ShortText
.. column_create Stations location COLUMN_SCALAR WGS84GeoPoint
.. load --table Stations
.. table_create Cities TABLE_HASH_KEY ShortText
.. column_create Cities location COLUMN_SCALAR WGS84GeoPoint
.. load --table Cities
.. [
.. {
.. "_key", "location"
.. },
.. {
.. "Tokyo", "128452975x503157902"
.. "New York City", "146566000x-266422000",
.. },
.. ]
This execution example creates a table named ``Stations`` which has one column named ``location``.
This execution example creates a table named ``Cities`` which has one column named ``location``.
``location`` column stores the value of coordinate.
The coordinate of Tokyo is stored as sample data.

.. groonga-command
.. include:: ../../example/reference/functions/geo_distance_location_rectangle.log
.. select Stations --output_columns _score --filter 1 --scorer '_score = geo_distance(location, "155047000x508862800", "rectangle")'
.. select Cities --output_columns _score --filter 1 --scorer '_score = geo_distance(location, "185428000x-461000", "rectangle")'
This sample shows that ``geo_distance`` use the value of ``location`` column
and the value of coordinate to calculate distance.

The value ("155047000x508862800") passed to ``geo_distance`` as the second argument is
the coordinate of Sapporo.
The value ("185428000x-461000") passed to ``geo_distance`` as the second argument is
the coordinate of London.


Using the explicitly specified value of location
Expand Down Expand Up @@ -137,10 +137,10 @@ This execution example creates a table named ``Geo`` which has one column named

.. groonga-command
.. include:: ../../example/reference/functions/geo_distance_distance_rectangle.log
.. select Geo --output_columns distance --scorer 'distance = geo_distance("128452975x503157902", "155047000x508862800", "rectangle")'
.. select Geo --output_columns distance --scorer 'distance = geo_distance("146566000x-266422000", "185428000x-461000", "rectangle")'
This sample shows that ``geo_distance`` use the coordinate of Tokyo
and the coordinate of Sapporo to calculate distance.
This sample shows that ``geo_distance`` use the coordinate of London
and the coordinate of New York to calculate distance.

Parameters
----------
Expand Down Expand Up @@ -252,7 +252,7 @@ Here is a sample about calculating the value of distance with column value.

.. groonga-command
.. include:: ../../example/reference/functions/geo_distance_location_sphere.log
.. select Stations --output_columns _score --filter 1 --scorer '_score = geo_distance(location, "155047000x508862800", "sphere")'
.. select Cities --output_columns _score --filter 1 --scorer '_score = geo_distance(location, "185428000x-461000", "sphere")'
``ellipsoid``
...............
Expand All @@ -270,7 +270,7 @@ Here is a sample about calculating the value of distance with column value.

.. groonga-command
.. include:: ../../example/reference/functions/geo_distance_location_ellipsoid.log
.. select Stations --output_columns _score --filter 1 --scorer '_score = geo_distance(location, "155047000x508862800", "ellipsoid")'
.. select Cities --output_columns _score --filter 1 --scorer '_score = geo_distance(location, "185428000x-461000", "ellipsoid")'
Return value
------------
Expand Down

0 comments on commit 6c59bfc

Please sign in to comment.