I got a problem in search widget which is when searching the displayed field for the suggestions does not match the field matched with search term.
Is there a way to handle it using displayField or suggestionTemplate property?
I'm using version 4.28.
Thanks in advance.
Make sure to change includeDefaultSources to false. I also make sure my sources searchFields, outFields, and diplayField are all the same.
const searchWidget = new Search({
view: theView,
searchAllEnabled: true,
maxResults: 10000000,
maxSuggestions: 10000000,
title: "Quick Parcel Search",
label: "Quick Parcel Search",
includeDefaultSources: false,
locationEnabled: false,
exactMatch: false,
sources: [
{
layer: parcelLayer,
searchFields: ["PartyName_1"],
name: "Search by Owner",
exactMatch: false,
outFields: ["PartyName_1"],
displayField: "PartyName_1",
},
{
layer: parcelLayer,
searchFields: ["PropertyAddress"],
name: "Search by Address",
exactMatch: false,
outFields: ["PropertyAddress"],
displayField: "PropertyAddress",
},
{
layer: parcelLayer,
searchFields: ["QuickRefID"],
name: "Search by Quick Reference ID",
exactMatch: false,
outFields: ["QuickRefID"],
displayField: "QuickRefID",
}
],
});
If I did so, the same layer will appear many times in the suggestions list and I don't want that to happen.
I believe the best way is to use suggestionTemplate property and add all fields used in the searchFields property.
I will attach pictures for your scenario.
Thanks.