[GIS] “Pagination not supported” error occurs when searching feature layers using the search widget

arcgis-javascript-api

I just upgraded to the 3.13 version of the JavaScript API, and I'm working on getting the new search widget (esri.dijit.Search) working in our application.

We have our own ArcGIS Server (10.1 I think) which hosts feature services, and I wanted to be able to search these using the search widget, in addition to addresses and such.

However, every time I try to search one of these feature services, I get a "Pagination not supported" error returned from the server. After a little debugging, I came to find that this was alleviated by removing the "resultRecordCount" parameter of the request that is sent in the query.

I snooped around in the code of the search widget and found that it's running a QueryTask under the hood, and passes a Query with the "num" property set to either the default value of 6 or a value I specify. In the documentation for Query (https://developers.arcgis.com/javascript/jsapi/query-amd.html#num), it's mentioned that the num property is only applicable for services hosted by ESRI.

The workaround right now seems to be creating my own locator service which wraps the feature query functionality, but I'm hoping this issue will get fixed in subsequent API versions. Or is there something I'm missing?

EDIT

Although I can't use any of our feature services in an example, since they're private, suppose we have a reference to an esri.layers.FeatureLayer layer which is hosted on an ArcGIS server version 10.1. What I'm doing is essentially the following:

var sources = searchWidget.get('sources');
sources.push({
    featureLayer: layer,
    searchFields: [layer.displayField],
    displayField: layer.displayField,
    name: layer.name,
    enableSuggestions: false
});
searchWidget.set('sources', sources);
searchWidget.startup();

searchWidget is a reference to an esri.dijit.Search which is placed in the UI. I initialize this widget with the following options:

{
    enableButtonMode: true,
    addLayersFromMap: false,
    enableInfoWindow: false,
    map: <esri.Map reference>
}

Given this setup, my expectation would be that I wouldn't get an error on the web request resulting from performing a search with the layer source selected, but instead I get the "Pagination not supported" error.

Best Answer

as stated in the API reference, support for 'suggestions' or 'autocomplete' specifically is what requires the pagination support that was introduced in ArcGIS Server 10.3 and also available in ArcGIS Online hosted feature services.

API Reference - Search Widget https://developers.arcgis.com/javascript/jsapi/search-amd.html#enablesuggestions

if you're unable to search for features at all, please supply a simple repro case. i'd be happy to take a look.