Hi, I'm using the Search widget in a custom 4.13 app. I have multiple search sources configured. Most of the time this works, however sometimes when clicking on a suggested item it goes to a completely wrong feature. My code for this app is pretty long, if required to post it I wont be able to do that until next Tuesday, so hopefully I can provide enough detail.
Here is my steps that produce this (sometimes). I enter "4" in the search and have a few suggestions. The search suggestion I click is "V-4278" which represents a chart id. It pans the map to a feature with id "V-4024" which is not what I picked (or even listed in the 5 max suggestions).
To try to dubug this I've inserted the following code which shows something that doesn't make sense to me:
searchWidget.on("select-result", function (event) {
console.log(event);
console.log(searchWidget);
});
Here is what is output in the console for that click on that suggestion:
event.result: {extent: {…}, feature: {…}, key: 14, name: "V-4024", sourceIndex: 6}
searchWidget.suggestions[6].results: {text: "V-4278", key: 14, sourceIndex: 6}
What I don't get is why do these both have the same key? That seems to be a problem, I just have no idea what the cause is. Any suggestions?
It also seems that if it goes to the wrong feature, it will always go to the same wrong feature (V-4278 always goes to V-4024, or V-4022 always goes to V-4011). What is also interesting is that when I click a suggestion it doesn't always go to it, sometimes I have to hit enter. When that happens it seems to always go to the correct feature.