Looking for the old docs site? You can still view it for a limited time here.

Configure the Suggest Component

  1. Choose a suggester implementation from the Solr Suggester documentation and define it in the solrconfig.xml file.

    In this example, a suggester called mySuggester is created in solrconfig.xml using the AnalyzingInfixLookupFactory and defining 'description' as the field to be suggested on:

    <searchComponent name="suggest" class="solr.SuggestComponent">
      <lst name="suggester">
        <str name="name">mySuggester</str>
        <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
        <str name="dictionaryImpl">DocumentDictionaryFactory</str>
        <str name="field">description</str>
        <str name="suggestAnalyzerFieldType">string</str>
        <str name="buildOnStartup">false</str>
      </lst>
    </searchComponent>
  2. Ensure that the field used for autosuggest is properly defined in the schema.

    <field name="description" type="text_general" stored="true" indexed="true" multivalued="false" />
  3. Once modified, the custom configuration files can be uploaded to Zookeeper using Zookeeper’s command line interface.

    The zkcli command putfile can be used to replace an existing ZK configuration file. Here CONFIG_NAME will likely represent the name of the collection, otherwise the name of a custom configuration that has been defined.

    VAR-FUSIONPATH/apps/solr-dist/server/scripts/cloud-scripts/zkcli.sh -z localhost:2181 -cmd putfile /configs/CONFIG_NAME/solrconfig.xml /Desktop/solrconfig.xml
  4. Enabling autosuggest in Fusion requires adding the "suggest" request handler to the AllowedRequestHandlers in the "Solr Query" stage of the query pipeline. The suggester should then be built using …​/suggest?suggest.build=true.

    Example:

    http://localhost:8764/api/query-pipelines/PIPELINE/collections/COLLECTION/suggest?suggest.build=true
  5. Start searching!

    http://localhost:8764/api/query-pipelines/PIPELINE/collections/COLLECTION/suggest?suggest.q=ca...