Database Reference
In-Depth Information
Listing 11-52.
returnLocationsWithinDistance in the LocationImpl interface
public List<MappedLocation>
returnLocationsWithinDistance
(Double lat, Double lon, Double distance) {
List<MappedLocation> locations =
mappedLocationRepository.locationsWithinDistance
(distanceQueryAsString(lat, lon,
distance));
// add the distance in miles to locations
addDistanceTo(locations, lat, lon);
return locations;
}
Locations with Product
To search for products nearby (Figure
11-17
), the application makes use of an autosuggest AJAX request, which
ultimately calls the search method (Listing 11-53) in the
MappedProductSearchRespository
interface. The method,
shown in Listing 11-54, returns an array of
MappedProductSearch
objects to the product field in the search form. It
applies the selected product's
productNodeId
.
Figure 11-17.
Searching for Products in stock at Locations within a certain distance of the User location