Quicksearch results by Taxonomies as well as Products

  • wpsolr
    Keymaster
    5 years ago #11173

    Try to find out why these SQL queries are slow.

    leomoon
    Participant
    4 years, 11 months ago #12093

    So I finally got around to moving the server to a whole new server and got everything to work much, much faster now. I was able to save suggestions config now – I guess it was timing out before.

    But, I am not having luck with jQuery selectors for suggestions.

    Dobro došli u antikvarijat Ex libris!

    Nothing happens when I type things in. Not even the rotating search animation. If I remove the jQuery selection field completely, I do get the spinning wheel, but no results (I don’t know where they go by default).

    Config 1
    Config 2

    leomoon
    Participant
    wpsolr
    Keymaster
    4 years, 11 months ago #12095

    Can I see your search boxes jQuery selectors?

    leomoon
    Participant
    4 years, 11 months ago #12097

    On the page itself test.antikvarijatknjiga.hr you can see on the upper right side the text I have inserted – that is where I temporarily directed WPSOLR to output search results: ID is #site-search. In the next to photos you can see how I configured section 2.3. The search input boxes are just standard post and product searches from woocommerce I inserted temporarily. I am not sure if I understand what else I need to send you?

    wpsolr
    Keymaster
    4 years, 11 months ago #12099

    Replace “#site-search” with your search boxes selectors. For instance: “.search-field:eq(0)” and “.search-field:eq(1)”

    leomoon
    Participant
    4 years, 11 months ago #12102

    Nevermind, I figured it out.

    leomoon
    Participant
    4 years, 11 months ago #12104

    It works like magic. Of course now, twig templates would be a great next step. Have you implemented this yet?

    leomoon
    Participant
    4 years, 11 months ago #12219

    Quicksearches work beautifully so far. I CSS-ed UL so that it is display:inline-flex, which may be the way many would want it.

    But, is there a way to label chosen data types other than the way they are named in the system? This option exists for faucets, but right now, my data is grouped as Product, Product Author, Product Publisher, Product Category, whereas it should be Title, Author, Publisher, Category.

    https://ibb.co/3Tv1BXw

    https://ibb.co/n3TS2hN

    wpsolr
    Keymaster
    4 years, 11 months ago #12220

    Thanks for the feedback.

    I’m working on suggestions right now. I just added prices for WooCommerce products and variations.

    1) I’ll add the labels indeed, as in facets.

    2) The idea of display:inline-flex is very nice. I’m thinking of creating an option “Vertical|Horizontal” on suggestions settings. Should we also get an option “Scroll (yes/no)” ?

    leomoon
    Participant
    4 years, 11 months ago #12277

    Prices are great addition.

    Scroll would also be a welcome option, although, we are starting to promote quicksearch into a full search 😉
    People might stop hitting an enter key to actually get full fauceted archive search results. In my case, it is not on the top priority list, but every option is welcome as long as it is an option.

    Also, it would be nice to wrap headings with some CSS-able class name, just like faucet labels are. From what I can tell, right now, there is no <span> or anything around labels in suggestions.

    wpsolr
    Keymaster
    4 years, 11 months ago #12278

    The latest twig code:

    {#*******************************************
    
    Build the suggestions results grouped
    
    {{ dump(suggestions) }}
    
    ********************************************#}
    
    {# Fancy css #}
    {{ include ("suggestions/fancy/suggestions-groups-css.twig") }}
    
    {% if suggestions.settings.image_width_pct > 0 %}
        <style>
            .c{{ suggestions.settings.suggestion_uuid }} .result-image {
                width: {{ suggestions.settings.image_width_pct }}%;
            }
        </style>
    {% endif %}
    
    {# Custom css #}
    {{ include ("suggestions/suggestions-custom-css.twig", {css: suggestions.settings.css}, with_context = false) }}
    
    <ul class="wpsolr_suggestions c{{ suggestions.settings.suggestion_uuid }}">
    
        {% for group in suggestions.results %}
    
            <h4>{{ group.label }}</h4>
            {% for result in group.items %}
                <li>
                    <div class="flex">
                        {% if result.image_src and suggestions.settings.image_width_pct > 0 %}
                            <div class="result-image">
                                <a href="{{ result.title.href }}" title="{{ result.title.title }}">
                                    <img src="{{ result.image_src }}" alt="{{ result.title.title }}">
                                </a>
                            </div>
                        {% endif %}
                        <div class="result-text">
                            <div class="title-wrap">
                                <p class="title">
                                    <a href="{{ result.title.href }}" title="{{ result.title.title }}">
                                        {{ result.title.title }}
                                    </a>
                                </p>
                                {# <p class="category"><a href="" title="">Shoes & Bags</a></p> #}
                            </div>
    
                            {# Other information, like price, added by WPSOLR extensiàon or custom code #}
                            {% for subtitle in result.subtitles %}
                                <p class="subhead">{{ subtitle }}</p>
                            {% endfor %}
    
                            <p class="desc">
                                {% if suggestions.settings.is_show_text and result.content|length > 10 %}
                                    {{ result.content }}
                                {% endif %}
                            </p>
                        </div>
                    </div>
                </li>
            {% endfor %}
    
        {% endfor %}
    
    </ul>
    wpsolr
    Keymaster
    4 years, 11 months ago #12284

    Let me know if you’re interested in a version that allows full customisation of the suggestions (both data and template).

    The plugin now contains a folder “/wpsolr-examples”, with a list of fully functional Twenty Sixteen child themes. The first child theme is about suggestions, with its functions.php full of code on how to create new twig templates and fill them with custom data.

    wpsolr
    Keymaster
    4 years, 10 months ago #12371

    Still interested in building your own custom twig template?

    yezzz
    Participant
    4 years, 10 months ago #12379

    I’ve seen websites that have a dropdown next to their search suggestions that act as a filter. For instance some rehub child themes have this and premium version of yith ajax search has this as well (the #search_categories dropdown in their demo… ignore the post_type dropdown for now).

    I’d be interested to have this, where search results would be “posts” of a specific posttype, and the filter dropdown would contain terms of a specified taxonomy. Is that what the triggers you describe can do?

Viewing 15 posts - 31 through 45 (of 57 total)

You must be logged in to reply to this topic.