"esri/dijit/Search" WHERE clause issue

622
2
12-04-2019 03:07 AM
EemeliP
New Contributor II

Hi,

I have implemented a custom widget. Within that widget I use the Search widget ("esri/dijit/Search") in order to, well search stuff. I' using the widget approximately as below:

// Using "esri/dijit/Search" in custom widget.
// Setting sources, every layer which is "Queryable" i.e. capabilities contains "Query".
// Search field is "GlobalID" and value is a GUID.

foreach( layer ) {
	sources.push(
		{
			featureLayer: this.map._layers[ layer ],
			enableLabel: false,
			searchFields: [ "GlobalID" ],
			displayField: "GlobalID",
			exactMatch: false,
			outFields: [ "*" ]
		} );
}
search.set( "sources", sources );
search.startup();
search.search( <GUID> );

This works fine in my developer enviroment (local WebAppBuilder and ArcGIS Online with developer account). If I use the same widget in our on-premise portal the search does not work and it returns:

{"error":{"code":500,"message":"Where clause is invalid.","details":[]}}

I noticed that the query params in the search requests differs between Online and On-premise portal:

Developer/Online:

where=UPPER(GlobalID)%20LIKE%20%27%25722380BF-FF9B-442E-9D9E-5C7A2CAF9E91%25%27&returnGeometry=true&spatialRel=esriSpatialRelIntersects&maxAllowableOffset=0.01866138385297604&outFields=*&outSR=102100&resultRecordCount=6&quantizationParameters=%7B%22mode%22%3A%22edit%22%7D

On-premise/portal

where=GlobalID%20%3D%20%7BBE77065E-ABAC-4A75-B79D-40800B477105%7D&returnGeometry=true&spatialRel=esriSpatialRelIntersects&maxAllowableOffset=0.01866138385297604&outFields=*&outSR=102100&resultRecordCount=6

Probably there are a lot of differences between Online and portal but more important question is that why that On-premise/portal WHERE clause does not work? And why are those clauses different as both seems to use same JS API version (3.28)?

Is it a bug in search Widget?

Regards,

Eemeli

0 Kudos
2 Replies
EemeliP
New Contributor II

Another question:

I just found out that in JS API documentation (Search | API Reference | ArcGIS API for JavaScript 3.30 ) It is said that "NOTE: When searching feature layers, the GlobalID field cannot be used to return results.".

Why is that? Does it mean that is should not be used, because clearly it's possible to use it as search term.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Eemeli,

   Sounds like there is a known issue with searching for GUIDs and thus the limitation is stated in the API documentation.

0 Kudos