Add debouncing to the suggestions field

  • pridigital
    5 months, 1 week ago #37272


    I’ve set up a suggestion box for the selector #my-suggestions, using the “Suggest Content” query along with the “WPSolr – Fancy” template. It’s functional, but it currently sends a new AJAX request for each keystroke in the input field. I’m curious if there’s a way to implement “debouncing” for this field.

    I believe incorporating debounce would be a valuable enhancement, following best practices, and would make a great addition to your plugin.

    For reference, you can google “debounce javascript” to see how such a functionality can work.

    Thank you!

    5 months, 1 week ago #37274

    Thanks for the feedback.

    Will be added to the release 23.6

    5 months ago #37369

    Is there a way you could give us early access to this feature? Our live website is crashing because of this. Thanks!

    5 months ago #37372

    As a workaround, you can try to update your file wpsolr-pro/wpsolr/core/js/autocomplete_solr.js, to add more parameters to the js library’s constructor $(this).devbridgeAutocomplete({...); (line 478)

    For instance, from jQuery-Autocomplete documentation:
    minChars: 3
    deferRequestBy: 100

    On next release, we’ll add a textarea in the suggestions settings to set your own JSON options.

    3 months ago #38495

    WPSOLR 23.7 is ready.

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

You must be logged in to reply to this topic.