aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2018-03-21 12:42:50 +0000
committerDave Arter <davea@mysociety.org>2018-04-10 10:42:34 +0100
commitf42de3bbb2e04614724cb8299e4fa9c8581b34b6 (patch)
tree7c4541b13bf095e28c9d647ae219347bc49fbdcc
parentf2b92da63ac147d18847396d9fb3d82231d73158 (diff)
Geocoders: allow cobrands to fixup user's search string
This is useful, for example, if the cobrand has a list of common typos that you want to account for.
-rw-r--r--perllib/FixMyStreet/Geocode/Bing.pm2
-rw-r--r--perllib/FixMyStreet/Geocode/Google.pm2
-rw-r--r--perllib/FixMyStreet/Geocode/OSM.pm2
3 files changed, 6 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Geocode/Bing.pm b/perllib/FixMyStreet/Geocode/Bing.pm
index a846f3348..9e425441a 100644
--- a/perllib/FixMyStreet/Geocode/Bing.pm
+++ b/perllib/FixMyStreet/Geocode/Bing.pm
@@ -20,6 +20,8 @@ sub string {
my ( $s, $c ) = @_;
my $params = $c->cobrand->disambiguate_location($s);
+ # Allow cobrand to fixup the user input
+ $s = $params->{string} if $params->{string};
$s = FixMyStreet::Geocode::escape($s);
$s .= '+' . $params->{town} if $params->{town} and $s !~ /$params->{town}/i;
diff --git a/perllib/FixMyStreet/Geocode/Google.pm b/perllib/FixMyStreet/Geocode/Google.pm
index 162101953..ad1881541 100644
--- a/perllib/FixMyStreet/Geocode/Google.pm
+++ b/perllib/FixMyStreet/Geocode/Google.pm
@@ -19,6 +19,8 @@ sub string {
my ( $s, $c ) = @_;
my $params = $c->cobrand->disambiguate_location($s);
+ # Allow cobrand to fixup the user input
+ $s = $params->{string} if $params->{string};
my $components = "";
diff --git a/perllib/FixMyStreet/Geocode/OSM.pm b/perllib/FixMyStreet/Geocode/OSM.pm
index d237f453b..4d57007c5 100644
--- a/perllib/FixMyStreet/Geocode/OSM.pm
+++ b/perllib/FixMyStreet/Geocode/OSM.pm
@@ -26,6 +26,8 @@ sub string {
my ( $s, $c ) = @_;
my $params = $c->cobrand->disambiguate_location($s);
+ # Allow cobrand to fixup the user input
+ $s = $params->{string} if $params->{string};
$s = FixMyStreet::Geocode::escape($s);
$s .= '+' . $params->{town} if $params->{town} and $s !~ /$params->{town}/i;