Search code examples
javascriptapiurl-encodingesriarcgis-js-api

ArcGIS JS API Search source searchFields - multiple fields not working


My application is not able to search in two (or more) fileds. The same problem is in a sample application by ESRI.

ESRI app sample: http://developers.arcgis.com/javascript/sandbox/sandbox.html?sample=search_customized

On line 130, this is OK: searchFields: ["Country"],

this is OK, too: searchFields: ["Rating"],

but, this is wrong: searchFields: ["Country", "Rating"],

The documentation says, that searchFields is an array of fields to search in (see https://developers.arcgis.com/javascript/jsapi/search-amd.html#sources)

Why not working, what is wrong?


Solution

  • I verified the link it is happening because of field data type; If you will open the sample layer REST URL you will see that "County" has string data type but "Rating" has integer data type.

    Layer's screen shot:

    enter image description here

    It not like it doesn't supports combination; its supports such combinations just you need to take care while you pass value in text box that should be integer. because for string it uses "like" and for integer it uses "=" operator.

    Hope this will help you :)