Is there a way to turn off the default Esri World Geocoder in the Search dijit and just use my local sources?

3035
2
Jump to solution
07-23-2015 11:14 AM
DirkVandervoort
Occasional Contributor II

The attached picture shows the search option I want to remove so the search options are just my local sources (below the Esri World Geocoder).

TIA

DefaultGCOff.png

0 Kudos
1 Solution

Accepted Solutions
JoshHevenor
Occasional Contributor II
geocoder = new Search({
    map: map,
    minCharacters: 3,
    activeSourceIndex: 'all'
}, "geocoder");


sources  = geocoder.get("sources");


// Change your sources
...


geocoder.set("sources", sources);

View solution in original post

2 Replies
JoshHevenor
Occasional Contributor II
geocoder = new Search({
    map: map,
    minCharacters: 3,
    activeSourceIndex: 'all'
}, "geocoder");


sources  = geocoder.get("sources");


// Change your sources
...


geocoder.set("sources", sources);
DirkVandervoort
Occasional Contributor II

Oops, a thousand pardons, I should have been more specific. The searched webmap is hosted at AGOL. The JSON data creating the searchable layers is show below. That being said, I can interrogate said JSON to build my search sources using the snippet you provided (which I think is also a JSAPI sample). Nonetheless, I didn't make the connection until your post. Thx

            "search": {
                "enabled": false,
                "disablePlaceFinder": true,
                "hintText": "Find Asset",
                "layers": [{
                    "id": "AnOutageStatus_9360",
                    "field": {
                        "name": "A_FIELD_NAME",
                        "exactMatch": false,
                        "type": "esriFieldTypeString"
                    }
                }, {
                    "id": "AnOutageStatus_3600",
                    "field": {
                        "name": "A_FIELD_NAME",
                        "exactMatch": false,
                        "type": "esriFieldTypeString"
                    }
                }, {
                    "id": "AnOutageContext_2098",
                    "field": {
                        "name": "A_FIELD_NAME",
                        "exactMatch": false,
                        "type": "esriFieldTypeString"
                    },
                    "subLayer": 1
                }, {
                    "id": "AnOutageContext_2098",
                    "field": {
                        "name": "A_FIELD_NAME",
                        "exactMatch": false,
                        "type": "esriFieldTypeString"
                    },
                    "subLayer": 0
                }]
            }

0 Kudos