Issues with relevance, etc.

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Issues with relevance, etc.

This topic contains 9 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 3 years, 9 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #18974
    sfm
    sfm
    Participant

    Hi,

    I am using the plugin to show results for apartment communities. I have entered all zip codes, cities, and states within a 20 miles radius of the property in the “Additional Search Tags” section of each property page.

    I think part of the issue is town names with spaces in them. New Milford is a town in North-East NJ. But Brakeley Gardens (nowhere nearby New Milford) IS near a town called Milford and it has New Jersey in the tags.

    So searching New Milford picks up the two separate tags in Brakeley Gardens and is returning it. There’s a place called New Vernon which is 50 miles way from a place called Vernon. New Vernon is close to some of our properties – Vernon is not. So I imagine someone searching for Vernon would get results that made not a lot of sense. There’s probably a bunch of other examples of that happening. There’s a town (and county) called Union and also Union City. Atlantic Highlands and Atlantic City. ETc etc.

    But outside of all of that – searching for East Brunswick brings up the one actual East Brunswick property as the very last result in a list of like 7. If there isn’t a way to control the order in some way according to the order the tags are listed (it doesn’t look like that impacts relevance unfortunately) even somehow fixing the results that show up wouldn’t be super helpful.

    Am I doing this wrong? Is there a better way to search for properties?

    Attachments:
    You must be logged in to view attached files.
    #18976
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    This is a tough one, but I think there is a possible way to improve it with a minor code customization and a few other changes.
    The problem with the additional search keywords field is, that it should be used for single keywords, that may describe the item as a result. It is not suitable for entering multi-word ‘phrases’. Another problem is, that recognizing phrases (such as multi-word city names) between word boundaries is basically impossible during the database search process. However I think that could be resolved for this specific case, with a special configuration.

    I have made a modification to the main search file, that will look for matches within custom fields, that only exactly match the whole search phrase, as well as only if the match is surrounded by a comma-space from both sides – so that only separate cities/zip codes are recognized.

    To make this one work, please follow the steps below:

    1. Before starting, make sure to have a full-site back-up of everything, just to be sure that nothing goes wrong.
    2. Open up the wp-content\plugins\ajax-search-pro\includes\classes\search\class-asp-search-cpt.php file on your server, and replace it’s contents with this. This change will make sure this specific boundary matching. Make sure to save this file.
    3. Instead of using the additional keywords field, let’s make a different custom field, I am using the name ‘search_locations’: https://i.imgur.com/ViHIH5z.png
    4. In this field, enter the city and zip code names, separated by a comma+space, like so:

    Big city1, Big city 2, Space city 1, Zip1123, Other city

    5. Save the post, save the field.
    6. On the search instance back-end options, make sure to choose this custom field for searching: https://i.imgur.com/Bcvxik3.png
    7. ..also, this will only work with the regular engine, so make sure you are using that: https://i.imgur.com/hLu2P1E.png
    8. ..and also, I recommend using this setup for the search logic: https://i.imgur.com/wcUw3ZN.png

    Now, entering a city name or a Zip code, will only match, if the whole phrase is matched between the boundaries, no partial matches. This is still not the fully expected solution, but I believe it is the closest possible one.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #18980
    sfm
    sfm
    Participant

    Ernest,

    Thanks for your response! I appreciate your detailed explanation as well. That should definitely help with things.

    I have another issue with the order that properties are displayed/ordered. Should it be pulling results according to the order the keywords are listed? Or does it have some different logic? The secondary type results don’t have to be ordered perfectly as it gets further, away but the property that is in the exact town (and the close surrounding) typed in does definitely need to be pulled first.

    Is it possible to pull from two custom fields and factor that into order? We could we have a “close_match” field and then the “search_locations” field where the property results from the “close_match” would show up first and the remainder from “search_locations” after?

    #19005
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Maybe, I am not sure about this one though. I have made a separate file, that considers ‘search_locations’ and ‘close_match’ custom fields. Matches within the ‘close_match’ custom field will increase the overall result relevance significantly (around 10 times). So keywords matching cities within that field should very likely be ordered first.

    Here is the modified version.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #19008
    sfm
    sfm
    Participant

    Hi Ernest,

    I made the update, but it doesn’t seem like the close_match relevance increase is working.

    For example, when you search “elizabeth” the first three results are “Water’s Edge at Rahway, Carlyle, and Elron.”

    Water’s Edge and Carlyle do not have “elizabeth” in the close_match field, but Elron does.

    Any other ideas?

    #19011
    sfm
    sfm
    Participant

    Also, but I wonder if it would be possible have a 3rd tier as the “Exact” match. Just so when you type in a town, you get the properties in the exact town first no matter what. There might be a situation somewhere in there where a bunch of properties grouped close in a neighboring town will still override the town. I can see it potentially happening with what we have around Union/Elizabeth off the top of my head. Elizabeth is like 1 mile away and the 4 complexes there should show up near the top but it could push the actual Union property to like the 5th on the list for typing in “Union”

    #19014
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Can you please add temporary back-end and FTP access as well? I would like to debug the code directly.

    I don’t think I am able to debug this on my local environment, as it highly depends on the configuration. On my end, it is working, but there are many options that could conflict with this modification.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #19023
    sfm
    sfm
    Participant
    You cannot access this content.
    #19024
    sfm
    sfm
    Participant
    You cannot access this content.
    #19034
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Thank you very much!

    I was able to debug the problem. The query was not counting the priority as it should have. I also added the 3rd tier custom field to the code, please use a custom field named exact_location for that. This has the highest priority of them all.
    It should return the results now accordingly.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Issues with relevance, etc.’ is closed to new replies.