wordpress-geo-mashup icon indicating copy to clipboard operation
wordpress-geo-mashup copied to clipboard

Zip code search not returning results for certain zip codes

Open lsterling03 opened this issue 8 years ago • 17 comments

Using the search widget with zip code, and it works for most of our locations. But there are four locations that do not show up in the results even if I type in their exact zip code. I've confirmed that their location info is correctly entered in the post. Those locations properly appear on the map and mashup map.

I don't see any errors in the console. I turned on debugging and no errors there either. I've deactivated all plugins and tried it with Twenty Ten. The problem remains.

I tried changing the zip code on one of the problem locations to a zip code that I know works. When I do that, it shows up in search results. When I changed it back to its real zip code, it no longer shows up in search results. I've, of course, made sure the radius was large enough.

I'm not sure what else to tell you. Can you think of a reason why this would happen, or what else I can do to troubleshoot?

lsterling03 avatar Mar 31 '16 00:03 lsterling03

In case it matters, these are the zip codes that don't work:

25177 22801 20109 20151

lsterling03 avatar Mar 31 '16 00:03 lsterling03

I saved a post with address "2503 Maccorkle Ave, St Albans, WV 25177", and a search for 25177 finds it. Which map provider are you using?

cyberhobo avatar Mar 31 '16 14:03 cyberhobo

I'm using Google V3 without an API key. I just tried it with Leaflet and OpenLayers and I still get the same problem. The locations are properly plotted on the map with each provider -- but still get a "no results found" from the zip code search.

This is strange!

On Thu, Mar 31, 2016 at 10:53 AM, Dylan Kuhn [email protected] wrote:

I saved a post with address "2503 Maccorkle Ave, St Albans, WV 25177", and a search for 25177 finds it. Which map provider are you using?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cyberhobo/wordpress-geo-mashup/issues/739#issuecomment-203973814

lsterling03 avatar Mar 31 '16 14:03 lsterling03

Can you add a post with the same address I used and see if that is found?

On Thu, Mar 31, 2016 at 7:58 AM, lsterling03 [email protected] wrote:

I'm using Google V3 without an API key. I just tried it with Leaflet and OpenLayers and I still get the same problem. The locations are properly plotted on the map with each provider -- but still get a "no results found" from the zip code search.

This is strange!

On Thu, Mar 31, 2016 at 10:53 AM, Dylan Kuhn [email protected] wrote:

I saved a post with address "2503 Maccorkle Ave, St Albans, WV 25177", and a search for 25177 finds it. Which map provider are you using?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub < https://github.com/cyberhobo/wordpress-geo-mashup/issues/739#issuecomment-203973814

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/cyberhobo/wordpress-geo-mashup/issues/739#issuecomment-203976077

cyberhobo avatar Mar 31 '16 15:03 cyberhobo

Unfortunately, that address didn't work either. So strange that it only happens to certain zip codes. Others still work just fine.

It seems clear now that the problem is on my end, but frustrating that I can't find a culprit even with the default theme and no plugins activated. If you have any ideas on another test I can try, I'd welcome any advice.

Thanks!

On Thu, Mar 31, 2016 at 11:05 AM, Dylan Kuhn [email protected] wrote:

Can you add a post with the same address I used and see if that is found?

On Thu, Mar 31, 2016 at 7:58 AM, lsterling03 [email protected] wrote:

I'm using Google V3 without an API key. I just tried it with Leaflet and OpenLayers and I still get the same problem. The locations are properly plotted on the map with each provider -- but still get a "no results found" from the zip code search.

This is strange!

On Thu, Mar 31, 2016 at 10:53 AM, Dylan Kuhn [email protected] wrote:

I saved a post with address "2503 Maccorkle Ave, St Albans, WV 25177", and a search for 25177 finds it. Which map provider are you using?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub <

https://github.com/cyberhobo/wordpress-geo-mashup/issues/739#issuecomment-203973814

— You are receiving this because you commented. Reply to this email directly or view it on GitHub < https://github.com/cyberhobo/wordpress-geo-mashup/issues/739#issuecomment-203976077

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cyberhobo/wordpress-geo-mashup/issues/739#issuecomment-203978537

lsterling03 avatar Mar 31 '16 15:03 lsterling03

Just to add to this....

If I type in the city name "St Albans" or "St Albans, VA" into the search field, the location does show up. It just doesn't show up if I type in the zip code "25177". I went line-by-line in the database to see if there was any difference in the way the working and non-working locations were saved, and they are all formatted the same.

Stumped.

lsterling03 avatar Apr 02 '16 15:04 lsterling03

That should result in a geocode request like this:

https://maps.google.com/maps/api/geocode/json?address=25177&language=en

Which returns St Albans for me. The only twist I can see is if your site language is not set to English perhaps?

cyberhobo avatar Apr 14 '16 02:04 cyberhobo

The site is set to English. I'm still trying to figure this out. I took a clone of the entire site and put it on another server, and everything works fine. So then I tried cloning that clone and moving it back to the live server... but the zips still will won't work there. The site is hosted on Rackspace cloud. I spent an hour on the phone with their tech support and they couldn't find anything wrong or anything different between the working and non-working server technology. Can you think of anything that would possibly be incompatible with Rackspace cloud sites?

One thing I did notice in the database is that the postal code field was not always filled in correctly for each location. Sometimes there were just 4 seemingly random numbers. But there wasn't any consistency in the mistakes -- meaning, some of the broken zips had correct postal code fields. And some of the working zips had incorrect postal code fields. But in case that was the problem, I manually edited the postal code field in the database for all locations and that field didn't have any effect either way.

Have you ever heard of any problems with your plugin on Rackspace?

On Apr 13, 2016, at 10:34 PM, Dylan Kuhn [email protected] wrote:

That should result in a geocode request like this:

https://maps.google.com/maps/api/geocode/json?address=25177&language=en

Which returns St Albans for me. The only twist I can see is if your site language is not set to English perhaps?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

lsterling03 avatar Apr 14 '16 03:04 lsterling03

No, I don't know of any Rackspace-specific issues. You could use this small plugin to see what results the URL above gives you on the Rackspace server.

cyberhobo avatar Apr 14 '16 03:04 cyberhobo

Thanks for that plugin -- interesting results. I put in this URL: https://maps.google.com/maps/api/geocode/json?address=25177&language=en and the Hostgator (cloned) site returned the correct results as expected.

The Rackspace site returned this:

{"headers":{"content-type":"application/json; charset=UTF-8","date":"Thu, 14 Apr 2016 14:03:48 GMT","pragma":"no-cache","expires":"Fri, 01 Jan 1990 00:00:00 GMT","cache-control":"no-cache, must-revalidate","access-control-allow-origin":"*","content-encoding":"gzip","server":"mafe","content-length":"224","x-xss-protection":"1; mode=block","x-frame-options":"SAMEORIGIN","alternate-protocol":"443:quic","alt-svc":"quic=":443"; ma=2592000; v="32,31,30,29,28,27,26,25""},"body":"{\n "error_message" : "You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console: https:// console.developers.google.com/apis/credentials?project=_",\n "results" : [],\n "status" : "OVER_QUERY_LIMIT"\n}\n","response":{"code":200,"message":"OK"},"cookies":[],"filename":null}

So it seems Rackspace requires you to use an API key. But that doesn't make sense either, because I tried that URL but with one of the working zip codes ( https://maps.google.com/maps/api/geocode/json?address=23220&language=en) and I got the same API error warning. But that 23220 zip code DOES work on the Rackspace site.

Crazy. I'll sign up for an API and see if that changes anything.

On Wed, Apr 13, 2016 at 11:35 PM, Lindsay Sterling [email protected] wrote:

Thank you. I'll give that a try.

On Apr 13, 2016, at 11:13 PM, Dylan Kuhn [email protected] wrote:

No, I don't know of any Rackspace-specific issues. You could use this small plugin https://github.com/cyberhobo/wp-remote-request-test to see what results the URL above gives you on the Rackspace server.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cyberhobo/wordpress-geo-mashup/issues/739#issuecomment-209737470

lsterling03 avatar Apr 14 '16 14:04 lsterling03

I signed up for a standard API and entered it into the Geo Mashup settings. The zips still don't work with the API.

lsterling03 avatar Apr 14 '16 14:04 lsterling03

I was never able to get those geocoding requests to work with an API key, so currently Geo Mashup doesn't attempt to use one. If you can give me an example URL with a key that works for you, maybe I can get that working again.

On Thu, Apr 14, 2016 at 7:19 AM, lsterling03 [email protected] wrote:

I signed up for a standard API and I still got the same "exceeded quota" error on Rackspace, for both working and non-working zip codes.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/cyberhobo/wordpress-geo-mashup/issues/739#issuecomment-209966237

cyberhobo avatar Apr 14 '16 15:04 cyberhobo

Here's request with my API key: https://maps.google.com/maps/api/geocode/json?address=22801&language=en&key=AIzaSyB0xMv0CFMrAROQKn3n7xAS96FpCkSq_n0

And here's a test page on Rackspace, stripped down with only 2 locations, one working and one not. Harrisonburg (22801) doesn't work. Richmond (23220) works. No plugins are activated except for GeoMashup.

http://www.landsaver.net.php56-29.ord1-1.websitetestlink.com/warehouse-locations/

Type in 22801 into the zip code search in the sidebar and you won't get any results, even though that's the zip code of the Harrisonburg location. But if you type in a different zip code that's near that location (22802), then you will see the result. Type in the word "Harrisonburg" and you will get the result. Just not with 22801.

On Thu, Apr 14, 2016 at 11:05 AM, Dylan Kuhn [email protected] wrote:

I was never able to get those geocoding requests to work with an API key, so currently Geo Mashup doesn't attempt to use one. If you can give me an example URL with a key that works for you, maybe I can get that working again.

On Thu, Apr 14, 2016 at 7:19 AM, lsterling03 [email protected] wrote:

I signed up for a standard API and I still got the same "exceeded quota" error on Rackspace, for both working and non-working zip codes.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub < https://github.com/cyberhobo/wordpress-geo-mashup/issues/739#issuecomment-209966237

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cyberhobo/wordpress-geo-mashup/issues/739#issuecomment-209989511

lsterling03 avatar Apr 14 '16 15:04 lsterling03

I'm hoping that #752 will solve this.

cyberhobo avatar Aug 03 '16 21:08 cyberhobo

I'm actually experiencing this on a recent install. Zip codes 55123 and 56085 aren't working:

https://yettioutdoors.com/dealers/

I tried a direct API call with my key and it does return results:

https://maps.google.com/maps/api/geocode/json?address=56085&language=en&key=mykey

Any thoughts? What else should I check?

TheJester12 avatar Aug 24 '17 17:08 TheJester12

@TheJester12, do you know if that is also a rackspace server? Have you tried using the remote request plugin to see if the results are the same on the server?

cyberhobo avatar Aug 27 '17 18:08 cyberhobo

The other thing that might be of interest could be added to your search results template after the No Results Found message:

       <p><?php _e( 'No results found.', 'GeoMashup' ); ?></p>

        <?php if ( GeoMashupDB::$geocode_error ) : ?>
            <--
            <?php echo GeoMashupDB::$geocode_error->get_error_code(); ?>
            <?php echo GeoMashupDB::$geocode_error->get_error_message(); ?>
            -->
        <?php endif; ?>

cyberhobo avatar Aug 27 '17 19:08 cyberhobo