Select to view content in your preferred language

Search Widget Error: The highlighting of the search result does not fit itself to the actual feature

1883
12
Jump to solution
08-21-2017 12:57 PM
BenjaminHarloe
Deactivated User

Hopefully the example below is enough to show what I'm talking about. In that picture I am searching for the feature that is marked by the pink line. The search tool finds it properly however the highlighting of the result (The bright blue line) does not fit the line like it should, but rather only fits the line approximately. Does anyone know what the cause of this could be? There aren't any other hidden layers that it could be accidentally displaying in the search result as far as I know. 

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Benjamin,

  It is an intended behavior (currently) The search widget will generalize the returned geometry using maxAllowableOffset of 1 to lessen the amount of data returned from the query. You can call tech support and make an enhancement request to have this configurable in the Search dijit.

View solution in original post

12 Replies
RobertScheitlin__GISP
MVP Emeritus

Benjamin,

   Can you post your configs/search/config_Search.json

0 Kudos
BenjaminHarloe
Deactivated User

Hi Robert, below is the code. The only thing is changed is I removed the URL's for the services. 

{
"allPlaceholder": "pipeline search",
"showInfoWindowOnSelect": true,
"sources": [
{
"layerId": "ReclaimedWater_6454_14",
"url": "",
"name": "Reclaim Pipe",
"placeholder": "pipeline search",
"searchFields": [
"GISOBJID",
"UNITID"
],
"displayField": "GISOBJID",
"exactMatch": false,
"searchInCurrentMapExtent": false,
"zoomScale": 50000,
"maxSuggestions": 6,
"maxResults": 6,
"type": "query"
},
{
"layerId": "Wastewater_1763_17",
"url": "",
"name": "Sewer Force Main",
"placeholder": "",
"searchFields": [
"GISOBJID",
"UNITID"
],
"displayField": "GISOBJID",
"exactMatch": false,
"searchInCurrentMapExtent": false,
"zoomScale": 50000,
"maxSuggestions": 6,
"maxResults": 6,
"type": "query"
},
{
"layerId": "Wastewater_1763_16",
"url": "",
"name": "Sewer Gravity Main",
"placeholder": "",
"searchFields": [
"UNITID",
"GISOBJID"
],
"displayField": "GISOBJID",
"exactMatch": false,
"searchInCurrentMapExtent": false,
"zoomScale": 50000,
"maxSuggestions": 6,
"maxResults": 6,
"type": "query"
},
{
"layerId": "Water_7426_18",
"url": "",
"name": "WATER_PIPE",
"placeholder": "",
"searchFields": [
"OBJECTID",
"UNITID"
],
"displayField": "GISOBJID",
"exactMatch": false,
"searchInCurrentMapExtent": false,
"zoomScale": 50000,
"maxSuggestions": 6,
"maxResults": 6,
"type": "query"
}
]
}

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Benjamin,

   In the Search Widget.js file find the _convertConfig and make this change:

Line 28 add a comma and new line then add line 29

      _convertConfig: function(config) {
        var sourceDefs = array.map(config.sources, lang.hitch(this, function(source) {
          var def = new Deferred();
          if (source && source.url && source.type === 'locator') {
            var _source = {
              locator: new Locator(source.url || ""),
              outFields: ["*"],
              singleLineFieldName: source.singleLineFieldName || "",
              name: jimuUtils.stripHTML(source.name || ""),
              placeholder: jimuUtils.stripHTML(source.placeholder || ""),
              countryCode: source.countryCode || "",
              maxSuggestions: source.maxSuggestions,
              maxResults: source.maxResults || 6,
              zoomScale: source.zoomScale || 50000,
              useMapExtent: !!source.searchInCurrentMapExtent
            };

            if (source.enableLocalSearch) {
              _source.localSearchOptions = {
                minScale: source.localSearchMinScale,
                distance: source.localSearchDistance
              };
            }

            def.resolve(_source);
          } else if (source && source.url && source.type === 'query') {
            var searchLayer = new FeatureLayer(source.url || null, {
              outFields: ["*"],
              maxAllowableOffset: 0
            });
BenjaminHarloe
Deactivated User

Hi Robert, I made the change and unfortunately the error is still occurring.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Benjamin,


  Did you make the change in the stemApp widgets folder or the actual apps search widget folder?

BenjaminHarloe
Deactivated User

I made the change in the actual app's search widget folder

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ok, that is the only thing i could think of that would cause the generalization of the geometry. I will have to see if i can replicate this and dig deeper.

BenjaminHarloe
Deactivated User

Thanks for the effort. I made an entirely new app and recreated the search widget and the error is still there so I don't think it's something unique to my specific app. But it's pretty frustrating, there's no way this can be a intended feature of the search tool right?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Benjamin,

   So after some in-depth research I have found that the JS API Search Dijit will set the maxAllowableOffset to 1 for the featurelayer that is searched and there does not seem to be any property that can be adjusted to prevent this. Here is a thread where one individual overcame this by hosting the API locally so that they could adjust this property to 0:

https://community.esri.com/thread/178135