2

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.

1

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.

  • See my edit for a repro case. – Mike Naughton May 8 '15 at 17:55
  • i still can't repro. what happens when you substitute your own service in this app? – John Gravois May 12 '15 at 21:03
  • I get the pagination not supported error. Here's the layer info. pastebin.com/A3cKZTUJ And it looks like the server is actually version 10.3, at least according to the containing service. – Mike Naughton May 13 '15 at 22:28
0

I have encountered the similiar error here with ArcServer 10.3.1 and API 3.27. My service is configured for "Advanceed Queries" and Pagination is supported, but get 0 results if the query is using the 'OR' operator. Taking a cue from Mike's observation above, I mirrored the Search.js file locally and removed line 774:

a.num = c.maxSuggestions || this.maxSuggestions;

Now all is well and results are being returned in the suggestion. This removes the 'resultRecordCount' parameter from the query, which seems to be the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.