diff --git a/internal/geocode/geocode.go b/internal/geocode/geocode.go index 337249aa3..ad9b4a3a8 100644 --- a/internal/geocode/geocode.go +++ b/internal/geocode/geocode.go @@ -49,11 +49,11 @@ type Rect struct { // AltLookupFn provides alternative geocode lookup in tests. // -// If AltLookupFn is not nil, Lookup calls AltLookupFn first, -// and returns the results unless it is (nil, nil). +// If AltLookupFn is not nil, Lookup returns the results of +// the AltLookupFn call. // // Lookup performs its standard lookup using its cache -// and the Google geocoding serice if AltLookupFn is nil, +// and the Google geocoding service if AltLookupFn is nil, // or it returns (nil, nil) for the address being looked up. // // It's up to the caller to change AltLookupFn only @@ -99,10 +99,7 @@ var ErrNoGoogleKey = errors.New("geocode: geocoding is not configured; see https // implementation is the Google geocoding service. func Lookup(ctx context.Context, address string) ([]Rect, error) { if AltLookupFn != nil { - r, err := AltLookupFn(ctx, address) - if r != nil || err != nil { - return r, err - } + return AltLookupFn(ctx, address) } mu.RLock() diff --git a/pkg/search/export_test.go b/pkg/search/export_test.go index ba91eca4f..88fdf7dfd 100644 --- a/pkg/search/export_test.go +++ b/pkg/search/export_test.go @@ -48,3 +48,5 @@ func (s *Handler) ExportGetPermanodeLocation(ctx context.Context, permaNode blob func ExportBestByLocation(res *SearchResult, loc map[blob.Ref]camtypes.Location, limit int) { bestByLocation(res, loc, limit) } + +var ExportUitdamLC = uitdamLC diff --git a/pkg/search/query_test.go b/pkg/search/query_test.go index c12b7db5c..430f504d1 100644 --- a/pkg/search/query_test.go +++ b/pkg/search/query_test.go @@ -1904,6 +1904,7 @@ func init() { cacheGeo("mexico", 32.7187629, -86.7105711, 14.5345486, -118.3649292) cacheGeo("brazil", 5.2717863, -29.3448224, -33.7506241, -73.98281709999999) cacheGeo("argentina", -21.7810459, -53.6374811, -55.05727899999999, -73.56036019999999) + cacheGeo("Uitdam", ExportUitdamLC.North, ExportUitdamLC.East, ExportUitdamLC.South, ExportUitdamLC.West) geocode.AltLookupFn = func(ctx context.Context, addr string) ([]geocode.Rect, error) { r, ok := altLocCache[addr]