/// <summary> /// Returns a ElasticsearchLocation object. /// </summary> /// <param name="parentLocation">Parent ElasticsearchLocation object</param> /// <param name="locationType">LocationType enum</param> /// <param name="locationView">GeoLocation object</param> /// public ElasticsearchLocation Build(LocationContext locationContext, GlobalContext globalContext) { var esDocument = BuildBaseObject(locationContext); globalContext.PreferredLocationNameService.SetPreferredName(esDocument, globalContext); SuggestionFormatService.SetSuggestion(esDocument, globalContext); globalContext.LocationSuggestionInputService.AddInputs(esDocument); globalContext.LocationAbbreviationService.AddAbbreviatedNames(esDocument); //globalContext.DuplicateSuggestionOutputResolverService.Resolve(esDocument); return(esDocument); }
private ElasticsearchLocation BuildBaseObject(LocationContext locationContext) { var esLocation = new ElasticsearchLocation { Country = (locationContext.ParentLocation == null) ? locationContext.LocationView.Name : locationContext.ParentLocation.Country, CountryCode = (locationContext.ParentLocation == null) ? locationContext.LocationView.CountryCode : locationContext.ParentLocation.CountryCode, CountryCtx = GetCountryCtx(locationContext.LocationView), Geometry = new ElasticsearchGeometry { Latitude = (float)locationContext.LocationView.Latitude, Longitude = (float)locationContext.LocationView.Longitude }, HierarchyPath = locationContext.LocationView.LocationPath, ID = locationContext.LocationView.Id, Population = SetPopulation(locationContext.LocationType, locationContext.LocationView), TypeID = (int)locationContext.LocationType }; esLocation = SetDivisions(esLocation, locationContext.ParentLocation); esLocation = SetLocationName(esLocation, locationContext.LocationType, locationContext.LocationView); return(esLocation); }