I have been using the Search Widget through several 4.x versions but the migration from v4.24 to v.4.26 is introducing problems with partial searches. In 4.26, the partial search does not return "non-exact" matches in the suggestions. The code is exactly the same in both versions (below) but the results are limited in v4.26 (see screengrabs). Any one have any ideas on what would have changed?
var searchWidget = new Search({
view: view,
container: "search",
allPlaceholder: "Search",
locationEnabled: false,
sources: [
{
layer: featureLayer,
searchFields: ['ID', 'NM'],
suggestionTemplate: '{NM} ({ID})',
exactMatch: false,
popupEnabled: true,
outFields: ['*'],
placeholder: 'Branch ID/Name',
name: 'Search Branch ID/Name',
zoomScale: 250000,
resultSymbol: {
type: 'simple-marker',
color: [0, 0, 0, 0.9],
style: 'circle',
outline: {
color: 'yellow',
width: 1
}
}
},
{
name: "USA Address Locator",
placeholder: "Enter USA Address",
singleLineFieldName: 'SingleLine',
url: "https://..."
}
],
includeDefaultSources: false,
});
Solved! Go to Solution.
Yes, please see this thread.
I believe I found some documentation explaining why this issue is occurring. Looking at the Layer Search Source documentation the following excerpt is stated:
For string field searches, there is no leading wildcard. This effectively makes exactMatch true, which will remove unnecessary search results and suggestions.
Wondering why this would be intentionally implemented. There is already a property (exactMatch) available to those who would want to omit a leading wildcard.
Anyone have any ideas on how to overwrite or include a wildcard?
Yes, please see this thread.