Database Reference
In-Depth Information
.WithParam("q", q)
.Return(() => Return.As<MappedProductSearch>(" { name: count(*), " +
" id: TOSTRING(ID(p)), label: p.title }"))
.OrderBy("p.title")
.Limit(5)
.Results.ToArray();
return mappedProductSearch;
}
Listing 7-49. The View Model Object— MappedProductSearch
public class MappedProductSearch
{
public string id { get; set; }
public string label { get; set; }
public string name { get; set; }
}
Once the product and distance have been set and the search is executed, the LocationController tests to see if a
prouctNodeId property has been set. If so, the controller calls returnLocationsWithinDistanceAndHasProduct in the
LocationService, as shown in Listing 7-50.
Listing 7-50. The returnLocationsWithinDistanceAndHasProduct in the LocationService
public GraphStory returnLocationsWithinDistanceAndHasProduct(GraphStory graphStory, double lat,
double lon, double distance)
{
string q = distanceQueryAsString(lat, lon, distance);
List<MappedLocation> mappedLocations= _graphClient.Cypher
.Start(new { n = Node.ByIndexQuery("geom", q), p = graphStory.product.noderef})
.Match(" n-[:HAS]->p ")
.Return(() => Return.As<MappedLocation>(" { locationId: n.locationId, address:
n.address , " +
" city: n.city , state: n.state, zip: n.zip , name: n.name, lat: n.lat , lon:
n.lon} "))
.Results.ToList();
addDistanceTo(mappedLocations, lat, lon);
graphStory.mappedLocations = mappedLocations;
return graphStory;
}
Intent Graph Model
The last part of the graph model exploration considers all the other graphs in order to suggest products based on the
Purchase entity, shown in Listing 7-51. The intent graph also considers the products, users, locations, and tags that are
connected based upon the Purchase entity.
 
Search WWH ::




Custom Search