Multiple Lookup Strategy

Open
#351 20 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
ruby
Domain
api, backend

Research direction

Start by reading the existing :lookup and :ip_lookup configuration and the current handling of geocoding exceptions and results. Define the fallback conditions, API-selection rules for IP and physical addresses, and configuration behavior; done means the strategy is specified clearly enough to implement and verify.

Written by the indexing model from the issue text.

Description

feature

We need a way to effectively use multiple geocoding APIs. Situations that need to be handled:

  • The primary API is unavailable and we'd like to automatically fall back to another.
  • The primary API is returning bad/unexpected results (or quota is reached) and we'd like to automatically fall back to another.
  • We'd like to use different APIs for different queries, depending on whether the query is an IP address or a physical address, but also if the query is for a certain part of the world where one API is significantly better than another (eg: Yandex in Russia).

Ideas for implementation:

  1. Set :lookup to an array of preferred APIs (descending preference).
  2. Set :lookup to a block which takes a query and returns a lookup name, or an array of names (as in #1).

Need to determine:

  • How to "fall back" to a less-preferable API. On timeout? On any API-related exception? On any Geocoder exception? On a particular API response? On a nil result? And how configurable does it need to be?
  • How to handle IP vs. physical address lookups in the config. Currently they are configured separately (:lookup and :ip_lookup). Is there an advantage to combining them?
Dominant language
Ruby
Stars
6.4k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from alexreisner/geocoder

All issues in alexreisner/geocoder

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.