rest-microservices
rest-microservices copied to clipboard
findByAddressLocationNear retrieves wrong suggestionss
I created a new customer
{"firstname":"yo","lastname":"yo","address": {"street":"12","zipCode":"123","city":"123", "location": {"latitude":"43.092318","longitude":"-70.792327"}}}
That gets stores in database:
{
"firstname" : "yo",
"lastname" : "yo",
"address" : {
"street" : "12",
"zipCode" : "123",
"city" : "123",
"location" : {
"latitude" : 43.092318,
"longitude" : -70.792327
}
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/customers/2"
},
"stores-nearby" : {
"href" : "http://localhost:8081/stores/search/findByAddressLocationNear?location=43.092318,-70.792327&distance=50km"
}
}
}
I've used, on purpose, the location of a shop
(43.092318, -70.792327)",1855 Woodbury Avenue,1855 Woodbury Avenue,,Portsmouth,NH,03801-3228,US,"(43.092318, -70.792327)",43.092318,-70.792327,06/22/2012 06:17:10 PM Starbucks,7459,Portsmouth/Market Square/Cigar Stor,Company Owned,18462,"Lunch, Oven-warmed Food, Reserve Amenity, Sirena Espresso Machine","Starbucks Card Mobile, Wireless Hotspot",,9999,Unknown,603-433-4471,"1 Market Square, Suite 17D
However when i follow the link to get findByAddressLocationNear the system does not suggest me that shop.
Seems not to be correct ...
http://localhost:8081/stores/search/findByAddressLocationNear?location=43.092318,-70.792327&page=1&size=1
"stores" : [ {
"id" : "550dbc2f44aea72d523302e4",
"name" : "Portsmouth/Market Square/Cigar Stor",
"address" : {
"street" : "1 Market Square, Suite 17D",
"city" : "Portsmouth",
"zip" : "03801-4011",
"location" : {
"x" : -70.758064,
"y" : 43.077086
}
},
"_links" : {
"self" : {
"href" : "http://localhost:8081/stores/550dbc2f44aea72d523302e4"
}
}
} ]
I guess that could be related to the Store
's location used a non-spatial index. That's fixed with 782e1cf5e05bef947e5756b11550a67c12855b89. Does that improve the results?