Search widget very slow

1855
3
02-03-2016 06:22 AM
RichardMoussopo
Occasional Contributor III

Why is my search widget so slow? it takes about 5 seconds, sometimes more to return suggestions even thought the service has the capability support pagination to true.

here is the code:

  var searchAddress = new Search({
                    enableButtonMode: false,
                    enableLabel: false,
                    enableInfoWindow: true,
                    showInfoWindowOnSelect: true,
                    map: map
                }, "adrSearch");


                var sourcesAddr = []; //search.get("sources");
                sourcesAddr.push({
                    featureLayer: new FeatureLayer(".../AddressTypes/MapServer/0"),
                    searchFields: ["LSN"],
                    displayField: "LSN",
                    exactMatch: false,
                    name: "Address",
                    outFields: ["*"],
                    placeholder: "Search address",
                    maxResults: 25,
                    maxSuggestions: 25,
                    enableSuggestions: true,
                    minCharacters: 3
                });
                searchAddress.set("sources", sourcesAddr);
                searchAddress.startup();

here is the snapshot of service capabilities:

support_pagination.PNG

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Richard,

  Do the fields that the search widget is using have indexes applied in ArcGIS. When you have a field in GIS that will be searched often, it is best practice to index that field in ArcCatalog.

RichardMoussopo
Occasional Contributor III

Thank you Robert for your reply, I did add the index field in Arc Catalog,

the waiting time did change a little bit, now down to about 3 seconds before showing suggestions.

I have about 66388 records. I am wondering if the number of rows has to do with this.

LSN_Index.PNG

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Richard,

   I would say definitely the number of records/rows is in direct correlation to time taken for suggestions to be returned.

0 Kudos