"No results found for…" replacing the search form

  • iuliansafta
    Participant
    4 years, 9 months ago #13532

    Hi,

    Recently I installed WPSOLR plugin for a project and I’m using the default [solr_search_shortcode] to search and display the results. Everything it’s ok until when I have no result, the plugin doesn’t display the form anymore, so I have to refresh the page or go back to the previews search.

    Debugging I’ve seen that:

    `
    fun_search_indexed_data()
    `
    returning this
    `
    echo “<span class=’infor’>” . sprintf(OptionLocalization::get_term($localization_options, ‘results_header_no_results_found’), WPSOLR_Service_Container::get_query()->get_wpsolr_query(”, true)) . “</span>”;
    `
    instead of a template.

    There is a way to maintain the search form when no results are returned from search?

    Thank you!

    wpsolr
    Keymaster
    4 years, 9 months ago #13533

    Which version do you use?

    iuliansafta
    Participant
    4 years, 9 months ago #13534

    Version: 21.5

    wpsolr
    Keymaster
    4 years, 9 months ago #13535

    The shortcode is deprecated. I suggest that you use the other option “Use my own theme” in screen 2.1.

    Then, your theme controls 100% the way results are displayed, including empty results.

    iuliansafta
    Participant
    4 years, 9 months ago #13536

    If I’m switching to “Use my own theme” I can benefit of “Cross-domain” search? From what I’ve read in the documentation search in multiple domains works “Only the shortcode Ajax template”.

    thanks!

    wpsolr
    Keymaster
    4 years, 9 months ago #13538

    You’re right. It is mandatory to use the Ajax shortcode with multi-domain search. The reason is that the_post() used by your theme will not work, as some posts come from other sites.

    Back to your original question then!

    The empty results message is taken from the localisations (screen 2.6), in fact the text “Message no results found”. You could use it to add your own text, eventually containing a link/button to the full search url /mysearch/?search=

    iuliansafta
    Participant
    4 years, 9 months ago #13551

    Thanks for your answer!

    I would like to ask you if this is going to change in the next versions? We’ll be able to have a custom (search form / display results) working with cross-domain search?

    wpsolr
    Keymaster
    4 years, 9 months ago #13554

    Here is a pre-release with a fix: the search form remains visible with empty results. Let me know if it is ok.

    https://www.dropbox.com/s/uvbub1ggj4n9ykb/wpsolr-pro-fix-no-results-found-for-replacing-the-search-form.zip?dl=0

    iuliansafta
    Participant
    4 years, 9 months ago #13555

    Hi,

    It’s working!

    Thank you!

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

You must be logged in to reply to this topic.