[Resuelto] Views / Maps Sort by distance incorrect if distance is 0.0 miles
This support ticket is created hace 4 años, 9 meses. 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.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
Link to a page where the issue can be seen: enlace oculto
I expected to see:
When searching for zip code 01776 I expected to see K T Fenton in the first page of search results. His address is Sudbury, MA 01776 so his distance comes up as 0.0 miles from the center of the search.
Instead, I got:
K T Fenton appears on page 13 of the search results instead of page 1.
It seems the partner with 0.0 miles from the search center shows up on random pages of the results, not always 13. I just tested again and he was on page 10. Still not correct (should be on page 1 as it is the nearest match).
Thanks for the details, I can see the problem in your website, I have tested it with below steps:
1) in location field fill value: Sudbury, MA 01776, USA, click submit button.
2) I see the item "K T Fenton" in page 11.
And I have tried the same setting(same address) in my localhost with a fresh WordPress installation + the latest version of Toolset plugins, there isn't the same problem in my localhost, it works fine, I can see all results are ordered by the distance correctly.
So the problem is abnormal, please check these:
1) Make sure you are using the latest version of Toolset plugins, you can download them here: https://toolset.com/account/downloads/
2) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020, deactivate all custom PHP/JS code snippets, and test again
If I delete K T Fenton's address and coordinates, save the record and then put the address (zip code / town) back in and save it, the search works correctly.
I worry that other partners may also have issues with their addresses. If you can see what the data issue is and what might have caused it, I'd love to know so I can perhaps figure out how to check the other partners easily with a DB query or something.
FYI deleting the address + coordinates, saving, putting the address back in only works if the stored location is also removed first in Settings | Maps | Stored Locations. That's why it didn't work for me before I opened the ticket....
Sorry for so many updates... on the live site, deleting the cached address, then deleting the address in the partner record, saving it and re-adding it does not work as it did in my localhost test so that may have been false hope or may indicate an issue with Views 3.0.2 which is what I still need to run on the live site due to the other issue I mentioned earlier.
Here are what I found:
I can install the database dump file in my localhost with a fresh WordPress installation, after login into the website dashboard, I see this message:
Toolset Maps: You've got some address data cached. Convert it to a new, more efficient format to gain significant performance benefits on Troubleshooting Page!
Please try these in your website:
Dashboard-> Toolset-> Settings
In the page bottom, click link "Toolset Debug Information",
In the "Toolset Debug Information" page, find section "Convert Maps address cache to new format", click button "Convert cache", it works fine in my localhost, see screenshot distance-filter4.JPG
We tried converting cache a while back but had to reverse it when we ran into issues with the Maps update using features in MySQL but not in MariaDB (we host on Kinsta which uses MariaDB). Maps eventually added a work around for this situation so we were able to update to newer Maps.
I tried converting the cache on staging just now and it didn't complete. I got this message:
Found 658 addresses in old cache.
Inserted 269 rows.
Cache could not be converted completely. Do not worry, it will be regenerated from the API.
And the search still doesn't work correctly.
Is there a way to delete the entire cache and let it rebuild?
My last reply reminded me that a key difference between my, and probably your, localhost environment and this site is that we're using MySQL and the site is on MariaDB. Just wanted to emphasize that in case it is a clue in your troubleshooting. Especially since we had other issues with Maps and MariaDB in the past that the Toolset developers eventually fixed.
Yes, I get the same message as you mentioned above in my localhost:
...
Cache could not be converted completely. Do not worry, it will be regenerated from the API.
So there should be other server issuse in your website, I have checked the "Debug information" you provided, you are using Mysql 5.5.5, but according to our document, it is required to use Mysql 5.6 or above: https://toolset.com/toolset-requirements/
Please try to upgrade your website Mysql server, and test again.
The DB is MariaDB, not MySQL but it reports itself as MySQL 5.5.5 for some reason in your debug info. It is actually MariaDB 10.4.7 which is newer than yours so I don't think that is the issue.
Since I have tested only your database dump file in my localhost, if there isn't other server issue, it should be a compatibility issue, please provide full copy of your website https://toolset.com/faq/provide-supporters-copy-site/