Getting Search suggestion from secondary field

Hey,

So if you're using App Search and Search UI, this code below should be similar for SearchBox:

<SearchBox
 autocompleteMinimumCharacters={3}
  autocompleteResults={{
    linkTarget: "_blank",
    sectionTitle: "Results",
    titleField: "contactInformation", // the field just to present the result
    urlField: "nps_link",
    shouldTrackClickThrough: true,
    clickThroughTags: ["test"]
  }}
  autocompleteSuggestions={true}
  debounceLength={0}
/>

Now see the titleField property, thats the field you specify to display the result. In this example its title but you could create a new field (for example contactInformation) which contains "[Name] [Address] [Phone no]". That field contents will be present when matches in the autocomplete results are shown.

Hope this helps.

1 Like