Select to view content in your preferred language

New Search in HeaderController (Flex Viewer 3.1)

3756
16
Jump to solution
12-26-2012 12:07 PM
TristanKnowlton
Frequent Contributor
This applies to the 3.1 version of the viewer.  I have configured the HeaderControllerWidget.xml to search my own data.  To do so I disabled the geocoding tags (<geocoding></geocoding>).  However when performing a search against my own address field in my parcel layer, the search is still using the geocoding service as well as my own data.  I don't know what else to try in order to completely disable the geocoding service.  Very annoying!!

Anyone have any ideas?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Darryl,

   Here is the changes in red. I am still struggling with the result grphic being added to the map when I think it should though.

find src\com\esri\viewer\components\singleLineSearch\SingleLineSearch.mxml and change the red lines.
           private function search():void             {                 currentState = "normal";                  if (!searchTerm)                 {                     return;                 }                  const hasCurrentSearchInProgress:Boolean = totalResultsToProcess > 0;                 if (hasCurrentSearchInProgress)                 {                     cursorManager.removeBusyCursor();                 }                  cursorManager.setBusyCursor();                 map.infoWindow.hide();                 totalResultsToProcess = 0;                 searchResults.removeAll();                                  if (!isFindEnabled){                     totalResultsToProcess++;                 }                  if (isFindEnabled)                 {                     totalResultsToProcess += searchLayers.length;                 }                  lastSearchTimestamp = getTimer();                                  if (!isFindEnabled){                     const addressData:Object = {};                     addressData[singleAddressFieldName] = searchTerm;                     var locatorParams:AddressToLocationsParameters = new AddressToLocationsParameters();                     locatorParams.address = addressData;                     locatorParams.outFields = [ "Ymax", "Ymin", "Xmax", "Xmin" ];                     locatorParams.location = map.extent.center;                     locatorParams.distance = calculateExtentRadius();                          locator.addressToLocations(locatorParams, new AsyncResponder(locator_resultHandler, locator_faultHandler, lastSearchTimestamp));                 }                  if (isFindEnabled)                 {                     var searchLayer:SearchLayer;                     for (var i1:Number = 0; i1 < searchLayers.length; i1++)                     {                         searchLayer = searchLayers[i1];                         findTask.url = searchLayer.layerURL;                         var findParams:FindParameters = new FindParameters();                         findParams.contains = true;                         findParams.layerIds = searchLayer.layerIds;                         findParams.searchFields = searchLayer.searchFields;                         findParams.searchText = searchTerm;                         findParams.outSpatialReference = map.spatialReference;                         findParams.returnGeometry = true;                          findTask.execute(findParams, new AsyncResponder(findTask_resultHandler, findTask_faultHandler, lastSearchTimestamp));                     }                 }             }

View solution in original post

0 Kudos
16 Replies
RobertScheitlin__GISP
MVP Emeritus
Darryl,

   This bug has already been reported to esri.
0 Kudos
TristanKnowlton
Frequent Contributor
Thanks for the reply Robert!  Any idea how long it takes for bugs to be addressed for an upcoming release?

Do you know if there is a bug reported for <simplefillsymbol>?  The use of fill symbols and outlines to highlight the search result doesnt work properly either.  Once you right click and clear, it sometimes wont come back. 

Never before have I jumped on a new release so early, now I know why that was a good idea.  Why release it if nothing works right?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Darryl,

   Well there is LOTs of stuff that works right in the viewer. As far as when it will be fixed the best I can say is it will most likely be in the next release. As a developer myself I have great empathy for what they go through trying to figure out every possible angle and use people will attempt and then develop and test for that...
0 Kudos
TristanKnowlton
Frequent Contributor
Well that's a good point Robert, lots of things do work right.  I was really looking forward to that particular enhancement and I spent too much time trying to figure out what I was doing wrong.  I was just a little sour:)
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Darryl,

   Are you working with the source code? If so I can give you the fix for this issue.
0 Kudos
TristanKnowlton
Frequent Contributor
I am.  That would be much appreciated.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Darryl,

  Can you provide your HeaderControllerWidget.xml search portion, so that I can see exactly what you are trying to configure?
0 Kudos
TristanKnowlton
Frequent Contributor
Here you go.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Darryl,

   Here is the changes in red. I am still struggling with the result grphic being added to the map when I think it should though.

find src\com\esri\viewer\components\singleLineSearch\SingleLineSearch.mxml and change the red lines.
           private function search():void             {                 currentState = "normal";                  if (!searchTerm)                 {                     return;                 }                  const hasCurrentSearchInProgress:Boolean = totalResultsToProcess > 0;                 if (hasCurrentSearchInProgress)                 {                     cursorManager.removeBusyCursor();                 }                  cursorManager.setBusyCursor();                 map.infoWindow.hide();                 totalResultsToProcess = 0;                 searchResults.removeAll();                                  if (!isFindEnabled){                     totalResultsToProcess++;                 }                  if (isFindEnabled)                 {                     totalResultsToProcess += searchLayers.length;                 }                  lastSearchTimestamp = getTimer();                                  if (!isFindEnabled){                     const addressData:Object = {};                     addressData[singleAddressFieldName] = searchTerm;                     var locatorParams:AddressToLocationsParameters = new AddressToLocationsParameters();                     locatorParams.address = addressData;                     locatorParams.outFields = [ "Ymax", "Ymin", "Xmax", "Xmin" ];                     locatorParams.location = map.extent.center;                     locatorParams.distance = calculateExtentRadius();                          locator.addressToLocations(locatorParams, new AsyncResponder(locator_resultHandler, locator_faultHandler, lastSearchTimestamp));                 }                  if (isFindEnabled)                 {                     var searchLayer:SearchLayer;                     for (var i1:Number = 0; i1 < searchLayers.length; i1++)                     {                         searchLayer = searchLayers[i1];                         findTask.url = searchLayer.layerURL;                         var findParams:FindParameters = new FindParameters();                         findParams.contains = true;                         findParams.layerIds = searchLayer.layerIds;                         findParams.searchFields = searchLayer.searchFields;                         findParams.searchText = searchTerm;                         findParams.outSpatialReference = map.spatialReference;                         findParams.returnGeometry = true;                          findTask.execute(findParams, new AsyncResponder(findTask_resultHandler, findTask_faultHandler, lastSearchTimestamp));                     }                 }             }
0 Kudos