Using URL to pre-populate search options

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Using URL to pre-populate search options

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

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #39062
    vincentb
    vincentb
    Participant

    Hi,
    First, I love the product, very impressive and super customizable!
    I read through the online doc and KB but could now find an answer to the following so any help would be appreciated.

    Context: I am trying to configure my site so that I can access certain pages based on preconfigured search queries, e.g., list all books with an appreciation score of 2.

    Setup: I have created a search page using only 2 elements (using Elementor):
    E1- A shortcode block (using my shortcode [wpdreams_ajaxsearchpro id=6])
    E2- A Posts block (with Advanced / CSS Classes set to asp_es_6)
    Search instance configuration:
    – Redirects to the search page as a Custom URL
    – Has “Update the browser address bar with the last selected options” enabled. Ordering of the results is NOT set to Random.
    – Filters on a numeric custom field (named “appreciation”) which has either no value, number “1”, or number “2” value set in the posts.
    Software: latest version of: the plugin, WP, Elementor Pro, and OceanWP theme.
    I intend to only configure the site through pages and blocks, not by writing php or javascript.

    Procedure: I navigate to the search page, set up search options as expected, and I expect that using the same URL I can get the same results if I use this URL in a menu item.

    Problems:
    P1- Navigating to the same URL as returned by the last search doesn’t always return the same results
    P2- The number of results returned generally exceed the amount of posts matching the condition (e.g., I have 33 posts matching appreciation=2 but I often get more that 40)
    No error is shown.

    Questions:
    Q1- Should I be able to use the URL generated by a previous search to get the same results by only navigating to it?
    Q2- Is it normal to get more results than the amount matching the criteria?

    *Edit:
    When using a results pane pagination mode other than “Infinite Scroll” or “Load on Click”, the problem happens more on initial load. Results come back correctly if user changes the option selection and reloads the page. However, when hardcoding the selection to a single value, the problem never disappears even without infinite scroll, and the wrong results are shown regardless of the option selection.

    • This topic was modified 1 month ago by vincentb . Reason: added repro steps (infinite scroll, ...)
    • This topic was modified 1 month ago by vincentb .
    #39071
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Okay, I did a few tests on our local server, but everything worked all right. Let me ask a few questions:
    – Do you happen to use any Elementor customization plugin of any sort? -> If yes, then try to turn it off temporarily to test to see if there is any difference.
    – Some elementor modules have custom query features – meaning you can change inclusions/exclusions, custom ordering etc.. -> If you use any of that, try to turn it off temporarily, then test again.
    – If you happen to use any custom code related to Elementor, search, then please disable that temporarily as well to test.

    Let me know if any of this changed anything.

    Best,
    Ernest Marcinko

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


    #39072
    vincentb
    vincentb
    Participant

    Thanks Ernest for your reply.

    I am using very few plugins, and no other Elementor plusins (just Elementor/Elementor Pro). I tested by deactivating all plugins except Elementor/ACF/CPT UI/Ajax Search Pro, and the results are the same: both problems still happen.

    Here is some additional info on this specific test case which allows me to reproduce the problem consistently (although there are multiple other situations happening):
    – ~1200 posts, all using one custom post type which is leveraging ACF custom fields
    – the “appreciation” field was created using ACF, of type numeric, optional
    – many posts have the appreciation field not filled
    – 33 posts have the appreciation field set to numeric value 2
    – a search page is set up to have only the 2 elements described in my original post, so all posts matching appreciation==2 can be displayed in-place in this page
    – the “Posts” block (element E2 described in my original post) is set this way in Elementor Pro:
    – Layout options: Skin=Cards, Columns=6, Posts per page=24, everything else turned off (so only showing a 300×300 image for each result)
    – Query options: Source=book (my custom post type), everything else left as defaults
    – Pagination options: Pagination=Infinite Scroll
    – Ajax Search Pro instance’s settings:
    – not showing search bar, just the appreciation custom field
    – Frontend Search Settings are configured only for Custom Fields, and just the “appreciation” custom field: “appreciation” post meta, Type=radio, Radio values=
    ||All
    2||Preferred**

    More info of the behavior observed:
    – Navigating to the search page shows the 2 radio buttons, with the second selected by default as expected
    – Search results are shown but have nothing to do with the selection made (not matching with appreciation=2)
    – Scrolling below the first page of 24 results shows up to hundred posts, all unrelated with the search
    – Switching from “Preferred” to “All” refreshes the search
    – Switching from “All” to “Preferred” refreshes the search but does not filter properly
    – Refreshing the page (F5 in Edge) reloads the page with a first page of results showing as expected (all appreciation=2)
    – Scrolling below starts showing results unrelated with the criteria

    If I set Posts Per Page=50 (more than the expected number of matching posts), refreshing the page displays the expected results and scrolling doesn’t show unrelated results.
    If I set Posts Per Page=4 (less than the page can display), refreshing the page displays 4 expected posts, and stars loading unrelated posted right after them.

    • This reply was modified 1 month ago by vincentb . Reason: added interesting test case with only Posts Per Page=4, showing that only the 1st page is relevant when refreshing
    #39074
    vincentb
    vincentb
    Participant
    You cannot access this content.
    #39079
    vincentb
    vincentb
    Participant
    You cannot access this content.
    #39090
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thank you for the details, unfortunately I still can not replicate.

    Can you please add temporary back-end and FTP access? I will try to debug this directly.

    Best,
    Ernest Marcinko

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


    #39098
    vincentb
    vincentb
    Participant
    You cannot access this content.
    #39124
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

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


    #39126
    vincentb
    vincentb
    Participant
    You cannot access this content.
    #39142
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

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


    #39173
    vincentb
    vincentb
    Participant
    You cannot access this content.
    #39174
    vincentb
    vincentb
    Participant
    You cannot access this content.
    #39192
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

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


    #39195
    vincentb
    vincentb
    Participant
    You cannot access this content.
    #39204
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Pefect, thank you very much 🙂

    I managed to find possible causes of the problem, and looks like it is eleminated now. The URLs look okay to me, a few stress tests were also successful. If it looks okay to you as well, I will push this quickfix to the next patch.

    Best,
    Ernest Marcinko

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


Viewing 15 posts - 1 through 15 (of 20 total)

You must be logged in to reply to this topic.