Search Widget (4.7) using a Map Service - not returning results

614
3
Jump to solution
04-24-2018 04:25 PM
AdamCrateau1
Occasional Contributor

I'm attempting to query a map service using the Search Widget (4.7).  The widget works fine when selecting from one of the list of suggested values as I begin typing.  When entering complete values (and hitting enter or the search icon), it returns "No Results", even when the value is valid.   I tried publishing the same data to AGOL, to test if its an issue with the map service.. and sure enough all works well with a feature service.

Has anyone else experienced this?  

Here's my code for reference:

var searchSources = [

  {
featureLayer: {
url: "https://.../arcgis/rest/services/Public/ParcelsTest/MapServer/0"
},
searchFields: ["TAXLOT"],
displayField: "TAXLOT",
name: "Taxlot Search",
placeholder: "Enter Taxlot Number",
popupOpenOnSelect: true,
maxResults: 6,
maxSuggestions: 6,
suggestionsEnabled: true,
minSuggestCharacters: 5
}

]

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Adam,


  Does the service have the query capability and have the ObjectId and shape fields visible?

View solution in original post

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Adam,


  Does the service have the query capability and have the ObjectId and shape fields visible?

0 Kudos
AdamCrateau1
Occasional Contributor

Robert,

Yes the service has Data, Map and Query operations allowed.   

The service has all fields visible.  Your comment got me heading down the right path though.   I added the outFields property to the search source object, and included the ObjectID and Shape fields...it works now!   This feels like a hack, but glad its working.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Adam,

   I wouldn't think of that as a hack. It is more of a requirement as the search needs to know which fields it will be working with.

0 Kudos