Permalink
Browse files

Clean up search code

  • Loading branch information...
1 parent c623774 commit 3aa60a71f4fc1ca69c97d7a386b6fa67f77db3e1 @autarch autarch committed Sep 2, 2012
Showing with 7 additions and 8 deletions.
  1. +7 −8 lib/VegGuide/Controller/Site.pm
View
15 lib/VegGuide/Controller/Site.pm
@@ -139,15 +139,14 @@ sub clone_entry_form : Local {
my $looks_like_address = 0;
- # Text contains some sort of postal code, possibly followed by
- # a country name. _Or_ it has > 1 comma, in which case it
- # pretty much has to be an address (I hope).
- $looks_like_address = 1
- if $text =~ /$PostalCodeRe (?:, \s* \D+)?$/xism
+ unless ( $c->request()->param('name_only') ) {
+ # Text contains some sort of postal code, possibly followed by
+ # a country name. _Or_ it has > 1 comma, in which case it
+ # pretty much has to be an address (I hope).
+ $looks_like_address = 1
+ if $text =~ /$PostalCodeRe (?:, \s* \D+)?$/xism
|| $text =~ tr/,/,/ > 1;
-
- $looks_like_address = 0
- if $c->request()->param('name_only');
+ }
# This handles things like "2600 Emerson Ave S, Minneapolis MN"
if ( !$looks_like_address

0 comments on commit 3aa60a7

Please sign in to comment.