C# Class Spontaneous.WebApp.Services.SearchUtility

Mostrar archivo Open project: pashkov/Spontaneous Class Usage Examples

Public Methods

Method Description
IngredientSearch ( int searchCount = 20, string searchText = null ) : List

Search in ingredients DB

SearchGeneralDish ( int searchCount = 20, string searchText = null ) : List

Search GeneralDish in DB

Private Methods

Method Description
CalcDistance ( Location sourceLocation, Location targetLocation ) : double

The Haversine formula according to Dr. Math. http://mathforum.org/library/drmath/view/51879.html dlon = lon2 - lon1 dlat = lat2 - lat1 a = (sin(dlat/2))^2 + cos(lat1) * cos(lat2) * (sin(dlon/2))^2 c = 2 * atan2(sqrt(a), sqrt(1-a)) d = R * c Where * dlon is the change in longitude * dlat is the change in latitude * c is the great circle distance in Radians. * R is the radius of a spherical Earth. * The locations of the two points in spherical coordinates (longitude and latitude) are lon1,lat1 and lon2, lat2.

http://www.codeproject.com/Articles/12269/Distance-between-locations-using-latitude-and-long

DishRestSearch ( Location userLocation, int searchCount = 20, string searchText = null, double maxDistance = 0.5 ) : List
FillGeoSearchItems ( MongoDB geoResults, Location sourceLocation ) : List
Search ( Location userLocation, int searchCount = 20, string searchText = null, double maxDistance = 0.5 ) : List

Naive implementation of search. Without full text search fetures. Based on location and IgnoreCase

Method Details

IngredientSearch() public method

Search in ingredients DB
public IngredientSearch ( int searchCount = 20, string searchText = null ) : List
searchCount int Max search results
searchText string Search text
return List

SearchGeneralDish() public method

Search GeneralDish in DB
public SearchGeneralDish ( int searchCount = 20, string searchText = null ) : List
searchCount int Max search results
searchText string Search text
return List