Search widget (4.13) suggestion does not go to correct result

621
2
Jump to solution
11-08-2019 01:59 PM
JoeRogan
New Contributor III

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.
0 Kudos
1 Solution

Accepted Solutions
JoeRogan
New Contributor III

This turned out to not be a problem with the app, widget or javascript related.  The cause was the data source was an Oracle DB (non geodata enabled).  The services was published with a multi machine ArcGIS Server configuration.  Each server machine was applying its own ObjectIds, but the search would not necessarily send it's query back to the same machine (round robin from the web adaptor).  Only solution was to stop publishing from Oracle, non geodata enabled database.  This database has caused many problems and this issue was the final straw.

View solution in original post

2 Replies
Noah-Sager
Esri Regular Contributor

Sorry to hear about the trouble. I'm not sure what's occurring. A simplified repro case will really help figure out what the issue is.

0 Kudos
JoeRogan
New Contributor III

This turned out to not be a problem with the app, widget or javascript related.  The cause was the data source was an Oracle DB (non geodata enabled).  The services was published with a multi machine ArcGIS Server configuration.  Each server machine was applying its own ObjectIds, but the search would not necessarily send it's query back to the same machine (round robin from the web adaptor).  Only solution was to stop publishing from Oracle, non geodata enabled database.  This database has caused many problems and this issue was the final straw.