Then I read the "sort" value to get distance of item location's to the
given location(lat:20,long:60). This works correctly if the item has
only one location but if there is more than one as in here:
{
"message" : "Locations",
"pin": {
"location": [[60,20],[50,20]]
}
}
The "sort" value becomes 1045.90911935061 not 0.0 as expected. It
doesn't matter if I am using desc or asc as the sorting order, but it
still gives the same output and calculates the distance from the last
array item.
Is there a way to get the distance to the closest location from that
array and sort items using some other query?
(Other than create index entries for each location)
Then I read the "sort" value to get distance of item location's to the
given location(lat:20,long:60). This works correctly if the item has
only one location but if there is more than one as in here:
{
"message" : "Locations",
"pin": {
"location": [[60,20],[50,20]]
}}
The "sort" value becomes 1045.90911935061 not 0.0 as expected. It
doesn't matter if I am using desc or asc as the sorting order, but it
still gives the same output and calculates the distance from the last
array item.
Is there a way to get the distance to the closest location from that
array and sort items using some other query?
(Other than create index entries for each location)
Sort has little meaning when there are multiple values, so its not really
aimed at solving that. If you want specific location to sort on, then index
it separately.
Then I read the "sort" value to get distance of item location's to the
given location(lat:20,long:60). This works correctly if the item has
only one location but if there is more than one as in here:
{
"message" : "Locations",
"pin": {
"location": [[60,20],[50,20]]
}}
The "sort" value becomes 1045.90911935061 not 0.0 as expected. It
doesn't matter if I am using desc or asc as the sorting order, but it
still gives the same output and calculates the distance from the last
array item.
Is there a way to get the distance to the closest location from that
array and sort items using some other query?
(Other than create index entries for each location)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.