• Resolved mflc

    (@mflc)


    It appears that the radius search filter isn’t working. I poked around to understand how it works and what it does, but it isn’t clear. In particular, when creating a new listing, filling out the “address” field but it isn’t found on the map. the map seems to be stuck on the default location in New York. I am using the Open Street mapping option.

    Some questions:

    • what exactly is the radius searching filtering on: location, map address, latitude/longitude, or the actual map pin?
    • Radius search only seems to appear if a search term is entered in the location search field, does that mean radius searches on location, or just that location is required in order to perform the radius search?
    • Can you explain how the radius slider works and interacts (or doesn’t have any relation) with the “address”, “location”, and the “map” fields?

    Thanks for any assistance in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter mflc

    (@mflc)

    following up – I found how to control whether the search radius filters based on address or zip. I set it to zip, but it seems to be wildly inaccurate.

    I type in 90210 for search and the query string for the resultant URL the search form generates is:

    directory_type=providers&zip=90210&zip_cityLat=47.68467725&zip_cityLng=17.632186276832662&minimum=60&miles=60

    which is in Hungary and not Los Angeles.

    • This reply was modified 4 months, 1 week ago by mflc.
    Thread Starter mflc

    (@mflc)

    additional follow up: after some additional testing, I can report the following:

    1. After setting the radius search field to use zip instead of address, the radius search slider seems to be connected to the zip field in the search form. when somebody enters a ZIP Code in the zip field the radius search slider control appears.
    2. When one types in a ZIP Code in the zip field, the two associated hidden fields (city latitude, city longitude) seem to respond. as long as you’re typing in a valid ZIP Code, the latitude and longitude seem to be changing dynamically.
    3. when you click apply filter, the page moves to the search results page, in the query string has the latitude and longitude from the hidden fields in the search form.

    despite all this seeming to work properly, nevertheless, search results page doesn’t return the correct results.

    I can say further that if I have a listing in the exact ZIP Code that I enter into the zip search field, the search results will not return that listing if radius search field in the search form is set to anything other than 0. In other words, if I enter the exact matching zip for the listing, and set radius search to 0 miles, it returns the listing. If i enter the exact matching zip for the listing and set radius to anything >0, it returns no results at all.

    • This reply was modified 4 months, 1 week ago by mflc.
    Thread Starter mflc

    (@mflc)

    Further followup – debugging through the code I discovered /directorist/includes/classes/class-geo-query.php which I suspect is managing the query handling the radius search. A simple test of 35 miles around the zip code 45237 yields the following query (among, many, many others, but this is the only one that seems like it relates to geo data and may be related to the zip code):

    wp_5_posts.ID, ( 3959 * acos( cos( radians(48.164960) ) * cos( radians( atbdp_geo_query_lat.meta_value ) ) * cos( radians( atbdp_geo_query_lng.meta_value ) – radians(21.988825) ) + sin( radians(48.164960) ) * sin( radians( atbdp_geo_query_lat.meta_value ) ) ) ) AS atbdp_geo_query_distance

    (note the posts table is wp_5_posts, because this is a subsite of multisite wp install)

    Note that the Lat/Long in the query is from somewhere in Hungary rather than in Ohio, USA (which is where my search zip code is located). My guess is that this is trying to take the search zip code and converting it to lat/long so it can be compared against other listings, but it is getting the wrong zip somehow? The other logical alternative is that the query is one of the listings it is trying to compare against, but that isn’t true since I have 100+ pages of listings but only one this query appears to use lat/long data.

    I double checked – and the lat/long for hungary is what shows up in the hidden fields associated to the zip/radius search control. I also noticed that as I type the zipcode in, a menu appears to select from – apparently different countries that the zipcode could match on, and even though I select US, it still brings in the lat/long for hungary.

    I went ahead and reset the search filter, then entered the 45237 zip again, and the lat/long showing in the hidden controls is now correct. however, searching on that zip with a radius of 28 miles returns no hits, whereas a search with a radius of 0 miles returns a single hit (the one entry is in that exact zip code). You can see an image of the developer tool data here: https://ibb.co/GTPMJzw

    Not sure at this point what more info I can gather from my end.

    • This reply was modified 4 months, 1 week ago by mflc.
    • This reply was modified 4 months, 1 week ago by mflc.
    Plugin Support Mahfuzul Alam

    (@mahfuz87)

    Hi @mflc
    ?
    ?Sorry for the late reply. Due to the political instability in?our country, the internet was disconnected, causing a delay in our response to you.
    ?
    ?Please contact to our support channel here – https://prnt.sc/cKSW-z2RTXrs. We need to investigate this issue on your website and try to find a solution for you. We will help you with this.
    ?
    ?Thank you for your patience and cooperation.
    ?
    ?Kind Regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.