Search Suggestion not correct

09-03-2019 09:42 PM
New Contributor III

I am using ArcGIS API for javascript 4.12. I have added a search widget into mapview. But the search suggestion is not correct. For example if i am searching 'Search CT' it is showing suggestion as 'Search RD'.  'Search CT' is available in data. Please help if you have any idea.



0 Kudos
3 Replies
MVP Regular Contributor

Hi Suraj Jha,

Can you please tell us a little bit more about the configuration of your Search widget? Are you searching a Feature Layer? Which fields?

You might have a look at this code sample for inspiration:

Search widget with multiple sources | ArcGIS API for JavaScript 4.12 

I hope you will manage to get it working after some additional research.



New Contributor III

Thanks for reply. We are using map service with layer id as a new feature layer for search. The url is like this . We have already tried the sandbox sample suggested by you but there also we have the same issue. The code is like below.

var featureLayerDistricts = new FeatureLayer({
" ",
popupTemplate: {
// autocasts as new PopupTemplate()
title: "My Search",
overwriteActions: true


0 Kudos
New Contributor III

One thing I would like to mention first time i get incorrect suggestion, after that when i delete couple of characters and re-type those characters I get the correct suggestions if again i do the same same thing I get incorrect suggestions. For example

1)First I type "Search CT" in search box I get "Search RD" as suggestions(Incorrect suggestions). 

2) I remove CT from Search box and type those(CT) again I get "Search CT" as suggestions (Correct Suggestions)

3) If I repeat step 2 I again get incorrect suggestions "Search RD" (Incorrect suggestions). 

Means if I perform step 2,  on every alternate search I am getting the correct suggestions. Hope I have explained the problem in details. If required I will provide more info.  Thanks.

0 Kudos