Fields with Domains not working in the search widget.

739
1
11-07-2018 06:38 AM
SarahFox1
New Contributor III

Good morning!
The search widget in my app isn't working for the fields with a domain.  It works for all the other fields that I've tried.  I've tried making a completely new search widget and hosted the data multiple times as both map images and feature layers, but nothing is working.  Do y'all have any clue what might be going on?

Thank you so much!

Update!

So apparently Domain fields do work, you just have to type in the full, exact name for the search widget to find it.   I don't know why this is.  Does anyone know what might be going on?  We need it to be able to guess what people are typing, because some of these places, no one knows how to spell.  Here is how I have it set up:

Tags (3)
0 Kudos
1 Reply
DianaBenedict1
New Contributor III

I too am experiencing the same issue. I have configured the ESRI Search Widget using Web AppBuilder 2.10. I noticed that search layers (using the query option) with esri String type do in fact work as expected. When you evaluate the network traffic, you will notice that a custom query is sent to the server as the user types into the Search Input box.

https://<myserverdomain>/arcgis/rest/services/MyServiceName/MapServer/3/query?

f=json&where=UPPER(TheFieldName)%20LIKE%20%27%25MAI%25%27&resultRecordCount=6

- this returns the top 6 values from the custom where clause to fill the suggestion list

However, when a layer is configured with a field set with a domain value, we DO NOT  see any network traffic being sent across. The only time you see the network traffic is when it submits the final Search Query when a user submits the request. I am assuming that this has to do with the Search Widget "knowing" that the field in question has associated domains for that field and therefore, sending a query as we see with "string" fields would not work. The actual values that are stored in the database may not necessarily be what the user is looking for. Again, I would think that a user would be looking for the Domain Description not the Code.

All of this information has already been downloaded to the client when the application Loads the Search Widget (look at the network traffic).

Example: https://<myserverdomain>/arcgis/rest/services/MyServiceName/MapServer/22?f=json 

- this returns the layer definition including all the fields and any associated domains for each field (Code/Description)

Each field in a feature layer (... /MapServer/0 or ... /FeatureServer/0) that has a domain can be accessed by using the featureLayer.fields[indexValue].domain on the client side. So there should be a way to generate that list of candidates/suggestions. Just probably not the same way as a field that does not have a domain (as shown above).

ESRI, is this something that the WAB team intended to do on the client side but it happens to not be working as expected?

Or is this functionality that was overlooked on the search tool because of the complexity?

Please advise as we have many different fields that we would like to search on that use the recommended ESRI Domain fields. 

Regards,

Diana Benedict

0 Kudos