Getting Mixed Search Results and Need Help with Filter Menu

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Getting Mixed Search Results and Need Help with Filter Menu

This topic contains 20 replies, has 2 voices, and was last updated by whynotadv whynotadv 1 week, 1 day ago.

Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #38424
    whynotadv
    whynotadv
    Participant

    I need help figuring out why when I use the quick search options and even when I just do a regular search in the search box for the following keywords that I’m seeing mixed results.

    Categories from the “Model Homes” Custom Post Type:
    One Story
    Two Story

    Every single time I search for “One Story” I see several Two Story Homes showing up and vice versa. When I search “Two Story” I keep seeing One Story Homes showing up in the results.

    My client is going to want this to be more accurate, when visitors search for One Story Homes, ONLY one story should be displayed in results.

    Can you help me fix this?

    Also, I cannot figure out how to show a drop down in the frontend filter menu that allows users to filter by Model Name. On my site, Model Name is just the standard WordPress Post Title so why is there no way to generate a drop down select menu whereby I see a list of all Model Names in the MODELS custom post type???? I’m so confused with everything. I’ve watched documentation and still can’t get it to work as intended. I’ve spent many hours troubleshooting and trying different settings. I just can’t do it.

    Please help.

    Thanks,
    Kenny

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

    Hi Kenny,

    Thank you for the details. I tried to log-in with the admin credentials to see the configuration, but they seem to be incorrect, can you check that?

    When searching “two story” it is possible, that the keyword “two” is present somewhere in the selected search fields, therefore it is considered a match. If you want to have more stric results like that, you can either try simply switching on the exact matching.
    If you don’t want that, you need to locate where that information is stored, and restrict the search fields to that. So if it is a category – then make sure that is enabled, and all of the unncessary fields are disabled (like title and content search).
    Usually the best course of action is using the exact matching in these cases.

    The reason you can’t create a filter based on the post titles is, that it is not possible, there is no such feature in the plugin. You can do taxonomy, custom field, date, user meta, post meta filters, but post title/content fields are not possible. We may implement a post title based filter in the future though. It depends, usually these types of post field filters are very problematic in terms of search performance.

    Best,
    Ernest Marcinko

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


    #38499
    whynotadv
    whynotadv
    Participant

    Ok I used exact match and that seemed to help for displaying the correct homes in each home style category, however, it doesn’t seem to work when I search using the ACF data ‘3 Beds’ or by the sq ft numbers such as 1,807. Also, I wanted to use the slider element in the filter menu instead of the multi drop down but I can’t get it to work.

    The other issue that I can’t fix but have discovered is that Ajax Search Pro uses isotope.js which is fine but there is something wrong in the code as it’s conflicting and causing glitches with the masonry post list with Thrive Theme Builder which is what I use to create my pages. How can you fix the conflict??? Here’s the page, https://jamyershomes.com/new/model-homes/ if you click view more homes load more button under the post list it goes to a huge white space and even you can see the glitched spacing. I already contacted Thrive Themes and they said something is not working properly. They used the network request blocking tool of Chrome, and blocked loading the script file /wp-content/plugins/ajax-search-pro/js/min/external/isotope.js and the glitches went away. They even disabled all other plugins to prove it.

    Please help.

    #38511
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    It highly depends on how the filters were created. If that is some sort of a drop-down or other string input type ACF field, then it may not store the actualy number, but an object or string data. For example instead of “3” it stores “3 beds”. That of course will not work with a slider type, because that is not a numeric field. I will have to check to confirm.

    I also need to test the bug, but when I tried to log-in, I could not. The admin details seem to be incorrect. Can you please check that?
    The isotope script is a custom built derivation of the metafizzy isotope script, completely independent, in a different variable scope. It looks more like a timing issue to me. I could not test it though, as the plugin is currently disabled.

    Best,
    Ernest Marcinko

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


    #38515
    whynotadv
    whynotadv
    Participant
    You cannot access this content.
    #38521
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thank you for the details!

    I managed to resolve the isotope issue. There was actually a line of code in that script file, which automatically queried elements with “data-masonry” attributes. That attribute was actually present on that posts list container – so isotope simply started to use that element as well. With a bit of debugging I found the line and removed it. The issue immediately went away. I will include this in the upcoming patch of course.

    The issue with the filters is a bit different though. The values entered into those fields are indeed not numeric. They are almost perfect, but there are spaces and “,” commas – which immediately makes them a string. Whenever using a numeric database operator – like the “between” in case of the range slider filter, the stored values have to be pure numeric – otherwise Mysql/MariaDB “quick” converts them to numbers during query, and that is not good.
    A numeric value in this case means numbers only, and for decimals a dot “.” as the decimal separator, like 123, 123.25, 0.1234 etc..
    Adding thousand separators (like spaces, commas etc..) will change the actual value. For example “1,2345” is not considered as “12345” but simply “1” (everything removed after the first non-numeric character during casting). This happens on the database level, that is not possible to affect unfortunately.

    For storing information it is always the best to use the proper format. For numbers I recommend using numbers only without any formatting. Formatting should be always done when the value is displayed.

    If you are planning to use that data for filtering purposes (with whichever plugin or future code or anything) the data should be rather converted to actualy numbers. ACF may actually have a number input, although I don’t exactly know if switching an existing field to that will automatically convert every previous value to numbers – but it is a great way to restrict the input to actual numbers only.

    Best,
    Ernest Marcinko

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


    #38523
    whynotadv
    whynotadv
    Participant

    Great Ernest! Thank you so much. You have no idea how frustrating that was! I appreciate the professional support, I numbered my remaining questions, hopefully this will be everything for now on…….
    |
    #1….
    ACF does have a number field indeed. I’ll backup my website and database and try to change the Bed, Bath and Sq. Ft. to the number field. On the frontend though, for Sq Ft I’ll need to add the comma in the number. Not sure how to do that, Thrive Themes doesn’t allow for formatting and not sure ACF number field allows for them. Example. 2,500 is the format not 2000 on the front end, I think the design looks nicer. I suppose I can live without the comma if necessary. Will the Ajax Search Pro Slider element work properly if I change the ACF field to be all ‘number’ fields?

    #2….
    I didn’t get an answer from you regarding the loading user experience…meaning….How can I restrict the results from auto-populating after just deselecting or choosing one filter option? I couldn’t even press the “Search Models” button before results just pop up instantly over top the filter screen, which is not ideal. If someone is using the filters menu, I think they should have time to select all the various filters they want before results pop up. Hope this makes sense?

    #3…
    Is there a way to center and adjust the filter box from the ajax search pro settings or do I have to use custom css? I don’t like how it’s off center and doesn’t look put together when you click the gold filter icon in the search input. SEE SCREENSHOT

    #4…
    Can you check one more compatibility problem with the masonry layout of Thrive Themes? I want to make sure it’s not a conflict causing this as well. There are abnormally large gaps between post list model homes as you scroll down and click View More Models you’ll see them https://jamyershomes.com/new/model-homes/ just tell me if it’s Thrive Themes or another conflict in isotope causing this issue??????

    Attachments:
    You must be logged in to view attached files.
    #38526
    whynotadv
    whynotadv
    Participant

    Ernest, Sorry for the additional message but I wanted to share my solution to #3 in my previous messaging. I was able to stylize the Filter box using custom CSS but wasn’t sure if any of it was actually in the plugin settings? Here’s my code, I highly recommend allowing users to customize in the Ajax Settings the following areas:

    /*Ajax Search Pro Filter Box Styling*/

    div.asp_w.asp_s.searchsettings {
    border-radius: 0 0 30px 30px;
    margin-top: 10px!important;
    border: 1px solid #bfbfbf;
    box-shadow:0px 5px 5px #9f823f;
    }

    .searchsettings, .asp_s.asp_s_1 {
    max-width:1200px!important;
    padding: 20px!important;
    margin-top:10px!important;
    }

    div.asp_s.asp_s_1.searchsettings form {
    justify-content:center;
    }

    div.asp_s.asp_s_1.searchsettings fieldset legend {

    padding: 0 0 10px 10px;
    font-weight: bold;
    font-family: “Cabin”;
    color: rgb(194 147 35);
    font-size: 16px;
    }

    div.asp_s.asp_s_1.searchsettings fieldset.asp_s_btn_container button.asp_search_btn.asp_s_btn, div.asp_sb.asp_sb_1.searchsettings fieldset.asp_s_btn_container button.asp_search_btn.asp_s_btn {

    background: rgb(240 179 16);
    border: 2px solid hsl(42deg 69% 45%);
    font-weight: bold;
    font-family: “Cabin”;
    font-size: 17px;
    }
    /*END Ajax Search Pro Filter Box Styling*/

    #38533
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    You are welcome!

    1. Definitely will work.

    2. Sorry about that, sure, by turning off this option: https://i.imgur.com/dn4hx5K.png

    3. From options it is not possible unfortunately, using custom CSS is the best way of doing that.

    4. That I can see even if the plugin is disabled, see: https://i.imgur.com/zHaVXg8.png
    It is unfortunately something else at fault there.

    Best,
    Ernest Marcinko

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


    #38539
    whynotadv
    whynotadv
    Participant

    Regarding #2:

    For some reason Since I turned that feature off now the filters are stuck on each filter options first value??? See my screenshot. I even added the rest button but it won’t clear any of the fields? I have no idea 🤷🏻‍♂️ what just happened. I Only change I made was for the Categories to be unselected but default because it felt backwards to already have all the categories pre-selected. Although checking the option to have categories deselected by default doesn’t seem to be working anyway. I cleared my cache. Please help.

    Thanks,
    Kenny

    • This reply was modified 2 weeks, 3 days ago by whynotadv . Reason: Added a detail about a setting I changed
    • This reply was modified 2 weeks, 3 days ago by whynotadv .
    Attachments:
    You must be logged in to view attached files.
    #38550
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Okays, I see the problem. That option should be “disabled” when you have individual categories chosen for display. In this case each checkbox can be controlled individually here via the checkboxes: https://i.imgur.com/N4xs9wh.png

    I have disabled them for you, now they should be unchecked.

    Best,
    Ernest Marcinko

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


    #38552
    whynotadv
    whynotadv
    Participant

    I don’t know what is happening. In the filter menu it won’t even let me choose a drop down value and the search keeps only showing the first criteria. Please help, I have no idea what is going on. I didn’t even change anything. It’s like the search is stuck on the first values in each field. Sorry. It was working great, now it’s not anymore.

    #38566
    whynotadv
    whynotadv
    Participant

    Hello again,
    I was able to get the models to come back up again which is good news. However, I have a few MUST-HAVE search settings that I need help with configuring…….

    1) Conditional filters on custom ACF field data associated with each other….Let me give this example: If a visitor selects “3” for Bedrooms out of the checkbox list. Is there a way to instantly hide or grey out the 3.5 baths, 3 Baths, 2.5 baths? Meaning, if the model post doesn’t have that data associated with “3” bedroom model homes, it will instantly grey or hide the unassociated values from other custom field checkboxes. Hope that makes sense. it would eliminate a lot of visitors from getting the “no results” message and getting frustrated because they can’t get a result to come up.

    2) I STILL cannot figure out the SLIDER for Sq Ft. Right now it’s showing every individual value for each model home and visitors can multi-select as many as they want. However, this is quite annoying because if they select 3 beds, 2 baths and pick a sq ft amount that doesn’t match a model home it will not show any results. I REALLY need the sq ft to be more of a range. For example: If the slider was set to 1000 – 5000 sqft and the user decides to stop at say 1500 sq ft. it would show any home 1500 and above perhaps to 1599. It would help eliminate NO RESULTS from happening every time.

    3) I still cannot get searches typed directly in the search box to show model homes when I type the following keywords (without manually added them to each model post, which is very tedious since I have 76 model homes I’d have to individually add custom keywords to.

    Any number associated with word….
    3 beds, 3 bedrooms
    3 baths, 3 bathrooms
    If I type a singular number in like 3, nothing comes up. Models that have 3 beds, or baths should come up

    By the way, I have CONVERTED Beds, Baths and Sq Ft. to a number field successfully.

    Again, in the filter box the Beds, baths and sq ft will actually query results but if I type the info in the search box NOTHING comes up.

    The only way I can get homes to pop up in the search box is if I type the Name of the model home ) which is the post title. Such as Remilee, Aubrey, etc.

    I’m so sorry for the long support requests, but I need to get this right so I can make my client happy.

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

    Hi,

    1. Unfortunately no. Conditional filters are not yet supported at this moment.

    2. I have changed that on the back-end to this. The values are indeed correct now, and the filter works correctly as well.

    3. Okay. First I changed the minimum number of word characters to 1 here with a secondary logic. That will allow singular character numbers to match partially.
    The numbers are covered, but the problem with these searches is the “bed” and “beds” keywords. Those do not occur anywhere in the text, nor in any taxonomy, nor any custom field – so it does not match.

    However the way you want this to work is not possible without massive keyword additions. Basically you would want the plugin to somehow “recognize” which numeric field to look for, depending on what exactly is entered. That is way beyond the capabilities of this plugin, that needs some machine learning stuff, and those are extremely expensive and very hard to implement.

    The kind of workaround for this is:
    – Creating a simple text custom field
    – Entering these desired phrases comma separated
    – Selecting this custom field for search
    – And also only allowing exact matches without secondary matching in the plugin settings

    With that, you have a comma separated list of additional keywords – which can be matched almost exactly. By “almost exactly” I mean some exceptional cases, where for example the field content is:
    3 beds, 1234 square ft, 4 baths
    The user enters 234 square ft, and it will still match the query. To get around that, each additional keyword would have to be placed in a separate custom field, and that is just not worth it at all in my opinion.

    This could be potentially even automated with a snippet, upon post saving it could fetch the values from the bedroom, bathroom and sq ft fields, and generate the additional keywords manually, and then put them into that new custom field to search for.

    I think that is the least amount of work for the best acceptable results, but this is only my opinion. It is beyond this support, but I am trying to help as much as possible.

    Best,
    Ernest Marcinko

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


    #38601
    whynotadv
    whynotadv
    Participant

    Thank you for explaining the level of complexity involved. There are Beds, Baths and Sq. Ft. Keywords on the individual model homes posts…see my screenshot. I suppose there’s no way for the plugin to recognize them like you said because they aren’t associated with the number.

    Idea… can you make adding search keywords an inline edit option in the WP admin via “admin columns pro” that would save me a ton of time and effort since I’m going to manually start adding all my variations to each model home post. It’s so speedy to work inline without having to go into the “edit post” screen each time. I pulled the second attachment from their website.

    Attachments:
    You must be logged in to view attached files.
Viewing 15 posts - 1 through 15 (of 21 total)

You must be logged in to reply to this topic.