Skip Navigation

[Gelöst] Geo search not working if location is not in dataset

This support ticket is created vor 6 Monate, 4 Wochen. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 3 Antworten, has 2 Stimmen.

Last updated by Nigel vor 6 Monate, 4 Wochen.

Assisted by: Nigel.

Author
Artikel
#2648963

Tell us what you are trying to do?
When I use the geo search with a radius I get returned the full data set if the location isn't in the database.
Using the link provided below.
(1) Note the length of the listing below the form. This is the full dataset. It starts with a listing from NY.
(2) Example of success: Leave all settings and enter "Boston, MA, USA". You'll see that a subset is shown below the form as expected.
(3) Example of failure: Enter "Watertown, MA, USA". You'll see the full dataset appear again. Watertown is an immediate neighbor of Boston, Cambridge, (West) Newton. It is well within the 50 mile radius.

Is there any documentation that you are following?
Couldn't find anything that spoke to this. Is there a Google Maps setting that needs to be changed?

Is there a similar example that we can see?
Can't think of one.

What is the link to your site?
hidden link

#2648965

Here's a screenshot of the View's Query Section:
hidden link

#2649161

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

Timezone: Europe/London (GMT+01:00)

Hi Chris

I can confirm the problem you describe on the front end, but can't account for it without being able to take a closer look at the back end, if that would be possible.

Let me mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.

#2649387

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

Timezone: Europe/London (GMT+01:00)

There's something odd going on with respect to searching for Watertown, MA, the corresponding coordinates don't seem to be being pulled from the address cache, so that part of the query is missing, and hence all results are returned.

I removed the corresponding entry in the cache manually and then searched again, which means the address used for the search should get added back to the cache, but it was not.

And checking the settings, it looks like your API key is invalid on this server, so that cache can't be updated. Meaning only searches that are an exact match for previous searches or the values stored against the posts will return the expected results.

So I temporarily replaced your restricted key with my personal unrestricted key, tried the search again, and it worked.

I've restored your key, but while the key doesn't work on the server the filter results won't always work as intended.

#2649411

Thank you, your feedback led to the fix.

For others that may encounter this issue:
The important bit is the last paragraph on https://toolset.com/course-lesson/creating-a-maps-api-key/#problems-with-displaying-markers-on-google-maps which reads "If Google Maps API key is restricted by domain, that may not work for users with multiple domains or subdomains. To solve this, you can enter a second API key for Google Maps, in the Toolset settings. When added, this second key is used exclusively for server-side requests. This means it is never exposed in HTML and does not need restrictions. If you want extra security, you can restrict it, but only by IP addresses, not by domains."
Following this note I went to Google Console (hidden link) I added a new API key that I restricted to the server's IP. I did not restrict the APIs. I entered this new key into the second API field in WP > Toolset Settings > Maps.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.