How do you get 'Did You Mean' and 'Search Information' blocks to appear?

  • ukdesignservices
    Participant
    # 3 months ago

    Hi. I’m looking through the .twig templates and I can see did-you-mean.twig and information.twig being included in the Ajax search. I was wondering how I include these templates on my search.php results page?

    Many thanks

    wpsolr
    Keymaster
    # 3 months ago

    These informations are only available to the Ajax search templates, when the Ajax mode is flagged on in 2.1

    Right now, there is no way to get them in your search.php.

    You can ask for that feature in https://www.wpsolr.com/forums/forum/technical-configuration-issues/new-features-requests/

    ukdesignservices
    Participant
    # 3 months ago

    Thanks. Sorry for the confusion, but the plugin indicates that the Ajax search templates are deprecated:

    https://www.dropbox.com/s/wct3bmpy0od90tv/ajax-search.PNG?dl=0

    Is that not the case?

    wpsolr
    Keymaster
    # 3 months ago

    I agree, it is confusing.

    1) Historically, the Ajax search template (no “s”) came first. It was a monolithic shortcode added to a page created by the plugin. Built with a long string of code, no customizations possible.

    2) Then came the “Use your own theme” option in 2.1 for archive pages, which intercepts the global $wp_query, but let the archive manipulate the results to display the UI as usual. With 2 exceptions: the WPSOLR widgets (facets, and sort) that can be inserted in the archive pages.

    3) The 2 widgets and the Ajax template shared the same code to display facets and sorts. This was the first refactoring of code.

    4) Then recently the Twig templates. Both the Ajax search template, and the 2 widgets, now receive data and pass it to their own twig files.

    So, the code has been cleaned quite a lot. But the Ajax search template is still monolithic: it is still made of other templates in a fixed manner. The results twig template, pagination twig template, did you mean twig template still leave inside the Ajax search twig template. They cannot be recombined at will, nor can be used as widgets, nor can be used standalone.

    5) Views
    Views are the next step, not planned yet. As for Toolset views, the idea would be to build custom views from several twig templates, customize their Elasticsearch/Solr query, and paste them anywhere. This is probably your goal, as I understand.

    Once we have views, then we can build almost anything. For instance Elementor widgets: drag&drop facets, results, pagination in a page, associated to a custom query.

    I hope this is a bit clearer now.

    ukdesignservices
    Participant
    # 3 months ago

    Thanks for the detailed response. Yes, that is clearer.

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

You must be logged in to reply to this topic.