jedwan
Forum Replies Created
-
AuthorPosts
-
I found it in custom taxonomy hooks actions file
$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]';
thank you for the suggestions. I want to change the url to the structure that I asked above.
I can change the structure by changing the code on line 244 to this$location_link_column = ", CONCAT_WS('/food_in', " . $concat_ws . ") AS location_link ";
Can you please point me to the line where you specify rewrite rules.
&gd_country=$matches[1]
&gd_region=$matches[2]
&gd_city=$matches[3]I can’t find these line in the code.
thanks
Hello,
Thank you for the response. Just to clarify, I’m not using locations as listings. I use locations as locations, except I have so many locations :).
If I’m on location London, I would like to see links to nearby Watford, Grays, Dartfort, Epsom, and other nearby cities…. Popular location widget already does that, except the cities are sorted by location_id or alphabetically.
Just point me to the query line and I will try to change that query to sort by distance.Maybe alphabetically, is there away to show a list of cities by distance from the location?
This reply has been marked as private.No, the widget has an option for selecting the number of cities I want to display. I only list the first selected cities by location_id.
fixed most of the slow queries problems by changing this query on line 417
// $main_location_query = "SELECT " . $fields . " FROM " .POST_LOCATION_TABLE." WHERE 2=2 " . $search_query . " GROUP BY $location_args[what] ORDER BY $location_args[what] $location_args[order_by] $limit";
to this query
$main_location_query = "SELECT " . $fields . " FROM " .POST_LOCATION_TABLE." WHERE 2=2 " . $search_query . $limit; }
and changing this query on line 4984
// $query = “SELECT ” . $args[‘fields’] . $location_link_column . ” FROM ” . POST_LOCATION_TABLE . ” WHERE 2=2 ” . $search_query . ” ” . $group_by . ” ” . $order_by . ” ” . $limit;
to this query
$query = “SELECT ” . $args[‘fields’] . $location_link_column . ” FROM ” . POST_LOCATION_TABLE . ” WHERE 2=2 ” . $search_query . ” ” . $limit;
`
Yes, I use cities and towns as locations. see below.
https://esalah.com/location/united-kingdom/greater-london/london/
https://esalah.com/location/united-kingdom/hertfordshire/london-colney/
https://esalah.com/location/france/paris/paris/Let me make it explain why I use locations with example.
Let’s assume I want a directory with everything Chinese related, restaurants, grocers, lawyers, carpenters, etc… from around the world. I’m not limiting my directory to one kind or few kinds of listings..
So when someone searches for Chinese lawyers in London, or Chinese grocers in Paris, or Chinese restaurants in Washington, I have a listing for that.
I have created xml sitemap (these are not included by default in your xml sitemap unless they have a listing) of these locations and it’s been crawled by google.I hope you get why I need the locations.
I love your plugin, it has everything that I want to do. the main plugin is really optimized and excellent. But location manager needs optimization, If you split the post-location table into 3 tables for city, region, and country, you will solve all these slow issues. I hope you have that in your plans for GD V2.
BTW, I cut query time for the above query from 2.7S to 0.0009S just by removing group by and order by.
I don’t understand why it was needed, it didn’t seem necessary.Why do you need group by and order by in that query anyway?
Yes these are locations with correct latitudes and longitudes. Mysql should be able to handle millions of lines if the queries are optimized and indexed correctly. I’m not sure sure why you say what I’m doing is not the best way to do things. You claimed your plugin can handle millions of locations but it didn’t deliver on that claim.
That is your query
I looked at the source code, I couldn’t find how to make changes to make it load few.
Can you point me to the exact lines?I’m working on this solution for now https://comp.esalah.com/live/ it works outside wordpress but
I need to implement it in the location manager, I get so many jquery conflicts.How do you change the settings to the ajax location switcher?
I have added the following indexes to the location table
Action Keyname Type Unique Packed Column Cardinality Collation Null Comment Edit Edit Drop Drop PRIMARY BTREE Yes No location_id 2618559 A No Edit Edit Drop Drop country_slug BTREE No No country_slug (50) 14231 A No region_slug (50) 36368 A No city_slug (50) 2618559 A No city (84) 2618559 A No Edit Edit Drop Drop region BTREE No No region 8529 A No region_slug 8529 A No Edit Edit Drop Drop city_slug BTREE No No city_slug (90) 2618559 A No city (90) 2618559 A No region (50) 2618559 A No country (50) 2618559 A No Edit Edit Drop Drop region_slug BTREE No No region_slug (50) 51344 A No city (90) 2618559 A No region (50) 2618559 A No country (50) 2618559 A No Edit Edit Drop Drop country BTREE No No country (50) 15966 A No country_slug (40) 15966 A No region (50) 20948 A No region_slug (50) 20948 A No
This has improved the combined query time from 30 seconds to less than 1 second. But to achieve this I had to change all OR queries in the location manager php code because indexes don’t work with OR query statements.
What is remaining is to find away to index or ajax autocomplete typing the location switcher shortcut code.
If I activate the location switcher feature in main menu, the page will take more than 2 minutes to load. Is there anyway to ajax autocomplete the location switcher?Thank you
I need the cities without the listing because that is the way I’m going to market to people to add their listings. I need the city to present exist.
The question is the location page have many duplicate queries. Have a look at my query monitor plugin -
AuthorPosts