Legacy Product

Fusion 5.10
    Fusion 5.10

    Configure Autocomplete

    App Studio supports the ability to generate suggestions on the fly, also called autocomplete or type-ahead, using the Terms component or Suggest component embedded in Fusion’s Solr core.

    The Solr Terms component provides access to the indexed terms in a field and the number of documents that match each term. This can be used, for example, to find all terms in the Solr index that match an expansion of the given query term. For example, "car" might return CARRY, CARRIED, CARE, CARL, and so on.

    Since the Terms component only allows suggestions one term at a time, in cases when multiple terms are being typed, suggestions are given for the last term typed.
    How to configure suggestions with the Terms component
    1. Configure Fusion:

      1. In Fusion, navigate to Querying > Query Pipelines.

      2. Select the query pipeline you are using.

      3. Select the Solr Query pipeline stage.

      4. Under configure Request Handlers Allowed for Queries, click Add Add.

      5. Enter "Terms".

        Add a request handler

      6. Click Save.

        Unlike the Suggest component, you do not need to modify solrconfig.xml to use the Terms component; it is preconfigured.
    2. Configure App Studio:

      1. Open config/services/suggestions/terms.conf.

        Its default content is as follows:

        name: twigkit.search.solr.suggestions.SolrQueryTermsService
        source: platforms.fusion
        
        # List out all fields to base your terms suggestions on
        term-fields: title
        title:
      2. Change the default source: platforms.fusion to source: platforms.fusion.data.

      3. Edit the value of term-fields as a comma-separated list of fields in your data from which to retrieve terms.

        This corresponds to Solr’s terms.fl parameter.
      4. Edit the value of title to describe the group of suggestions returned by Fusion.

        This title can be used to group suggestions in the UI. If you are implementing only one group of suggestions, you can leave this blank or set it to something generic, like "Suggested phrases".

      5. Save and close the file.

      6. Open app/views/partials/header.tpl.html.

      7. Uncomment the following line:

        <query-suggestions completion-service="services.suggestions.terms" action="/search"></query-suggestions>
      8. Save the file.

    3. Refresh the search UI in your browser.

    4. Test the feature by typing a search phrase.

      App Studio now displays suggested terms on the fly:

      Suggested terms

    The remaining attributes shown above are optional and are the same as described above for when backwards compatibility is disabled.