Search Widget Results

2372
10
10-13-2015 09:47 AM
AshleyPeters
Occasional Contributor III

I'm using the search multiple sources example (https://developers.arcgis.com/javascript/jssamples/search_multiplesources.html) and I'm beginning to modify it to fit my needs. It's more or less working as it should, except for the results it returns when the search should select multiple points and instead it chooses just one.

For example, I want to find the boat ramps on a particular body of water. I input Pickwick, and it's automatically returning one ramp, instead of the 5 or 6 it should.

Anyone else run into this? Here's the applicable portion of my code, as it is now:

sources.push({
 featureLayer: new FeatureLayer("https://conservationgis.alabama.gov/adcnrweb/rest/services/Fishing_DCNR/MapServer/5"),
 searchFields: ["Waterbody"],
 displayField: "Access_Are",
 exactMatch: false,
 outFields:["Access_Are"],
 name: "Boat Ramps",
 placeholder: "Waterbody Name",
 maxResults: 15,
 maxSuggestions: 15,
 infoTemplate: rampsInfoTemplate,
 enableSuggestions: true,
 minCharacters: 0
 });
0 Kudos
10 Replies
RobertScheitlin__GISP
MVP Emeritus

Ashley,

   Because your server is 10.2.1 you do not get a menu of Suggestions. The results coming back from your featurelayer do include all the results you are expecting but if your server is not 10.3 then a menu list of suggestions are not presented in the UI of the search dijit.

0 Kudos
AshleyPeters
Occasional Contributor III

Thanks Robert. When I read over the documentation I took the comments about the suggestions to be something that dealt with the autofill of possible 'answers' as a user typed in the search box based on what was included in the attribute table, and not with the results themselves.

This wasn't an issue with the FlexViewer search widget. Is there a way to get the search in JavaScript to perform similar to the Flex search widget?

0 Kudos
IsaacLañado
New Contributor II

Hi, Robert Scheitlin, GISP‌,

I know this post is quite old but I'm having the same problem as Ashley, my server is version 10.2.2 and for the moment we are unable to upgrade to 10.3, is the a way to get a results box with API 4.4? I can search and it zooms directly into the first result but I would prefer to get a results list so that the user can select which result he wants.

I was playing with "search-complete" to create a widget but im finding it quite difficult.

Thank you

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Isaac,

   No that I am aware of if you are using such an old server version.

0 Kudos
IsaacLañado
New Contributor II

Robert Scheitlin, GISP

I've managed with my company to upgrade the Server and ArcMap to 10.3.1, I've already saved the project and published my MapServer on the 10.3.1 server.

But the search results still don't have the suggestions and when you click enter it sends you to de first result it finds.

Here is how I'm creating the search widget source

var source = {
    featureLayer: new FeatureLayer({
    url: "http://www.domain.com/map/rest/services/.../.../MapServer/2",
    searchFields: [layer.displayField],
    displayField: layer.displayField,
    exactMatch: false,
    outFields: ["*"],
    name: layer.title,
    autoSelect: false,
    suggestionsEnabled: true,
    minSuggestCharacters: 0
}
searchWidget.sources.push(source);

Hope you can help me.

Thank you,

Isaac

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Isaac,

   The autoSelect property is for the search dijit itself and not part of the source property.

searchWidget.autoSelect = false;
0 Kudos
IsaacLañado
New Contributor II

Thanks for the quick reply, that solves one of my problems, jejeje. But the suggestions still don't show up when I'm typing in the search box, is there something I have to do on ArcMap to activate this? I'm not using any RDBMS, all my info is in the map.

Thank you for your time

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Issaic,

Suggestions are available if working with a 10.3 or later geocoding service that has suggest capability loaded or a 10.3 or later feature layer that supports pagination, i.e. supportsPagination = true.

Check if supportsPaginiation is true for your map service you are using.

IsaacLañado
New Contributor II

Yeah, I've looked into that and my layers says supportPagination = false and Supports Advanced Queries: false.

I've researched on the forum and found this: How do you enable the "Supports Pagination" on a layer at 10.3? It says it only activates if the database allows it, but I'm not using any database (SQL, Oracle, Postgres). I don't know if I'm using FileGDB how can I check? and if so how do I enable the pagination feature.

Thanks

0 Kudos