0

I am using Sitecore 9.0.1 with SXA 1.7 and Solr 6.6.2. I have added one search box and search result component on my page and selected the ShowSearchResults as Prediction and it is showing the predictions based on the title field.

Is it Possible to show suggestion on the search box based on specific field which has data type as Single line text?

I have an "Author" field in my template and I want to show the author field values as a suggestion when typed on the search box.

For this I made some config change by following this blog https://tamermblog.wordpress.com/2018/02/20/setting-up-sxa-search-box-with-suggest/

This is my Solr config file.

enter image description here

Right now I am getting results only based on the title

enter image description here

Please suggest if I'm doing wrong

Thank you

1

1 Answer 1

1

I am using Solr 8.4 with Sitecore 10.1 I have used the following configuration and it works fine. The trick is to define the Field you want to see in the payloadField parameter Here's my suggester configuration.You can see the payload parameter in this configuration. title_t

<searchComponent name="suggest" class="solr.SuggestComponent">
        <lst name="suggester">
            <str name="name">sxaSuggester</str>
            <str name="lookupImpl">BlendedInfixLookupFactory</str>
            <str name="dictionaryImpl">DocumentDictionaryFactory</str>
            <str name="contextField">_language</str>
            <str name="field">title_t</str>
            <str name="suggestAnalyzerFieldType">text_general</str>
            <str name="payloadField">title_t</str>
            <str name="buildOnStartup">true</str>
        </lst>
    </searchComponent>
    <requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy" >
        <lst name="defaults">
            <str name="suggest.dictionary">sxaSuggester</str>
            <str name="suggest">true</str>
            <str name="suggest.onlyMorePopular">true</str>
            <str name="suggest.count">10</str>
            <str name="suggest.collate">true</str>
        </lst>
        <arr name="components">
            <str>suggest</str>
        </arr>
    </requestHandler>

I am getting suggestions as value of title field as I want title field to be fetched in the suggestions.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.