Select to view content in your preferred language

Park Finder - Can't search by Park Name

3746
14
04-16-2013 11:22 AM
Labels (1)
Allison_Laforet__Charko
New Contributor III
We have been successful in publishing the Parks Finder app with our municipality's data.
One thing that we are having issues with is searching by park name.
If we search by park name, we do not get any results.  If we search by activity, we get all of the expected results.
Is anyone else having this problem or does anyone know the solution to this?


[ATTACH=CONFIG]23559[/ATTACH]

Thanks,
Allison
0 Kudos
14 Replies
BrianLord1
Occasional Contributor
You will want to check the "SearchFields" part in the config.txt and make sure the field listed match the actual fieldnames in your data.

You can also use firebug to see what is returned from yuor query.
0 Kudos
Allison_Laforet__Charko
New Contributor III
Thanks Mark,
We checked our field name and the field name and the alias match what we published in server.
We had one of our IT people step through the JS part of the code and it looks like the searchfield is always set to "FacilitySitePoint.NAME" yet when you search for the activity "baseball" the correct parks appear (coming from the ParkRecInfo.BASEBALL field).
Any other ideas?
Is there anything else is the config file that needs tweaking? We downloaded the template right from the site and only changed what was asked to be changed.
Thanks in advance,
Allison
0 Kudos
BrianLord1
Occasional Contributor
That makes sense because the program actually uses two separate functions to find parks with a matching name and parks that have the specific activity.  Based on what you are describing it seems like there is a disconnect between the field name that the program is looking for and the actual field name.

Could you upload a screenshot of the config.txt file, specifically the lines that set the search fields?  Or just show me the code like I did below.  It should look something like this...

[HTML]//Fields used for searching the features through find task.
'SearchFields': "NAME",
[/HTML]

Also, a screenshot of the rest endpoint for the map service like the one I attached?

Thanks,
Mark
0 Kudos
LindsayThomas
Esri Contributor
Sounds like this is solved but I wanted to add this link to a technical article about this issue.

http://support.esri.com/en/knowledgebase/techarticles/detail/40287

-Lindsay
0 Kudos
Allison_Laforet__Charko
New Contributor III
Hi Mark,
Sorry for the delay - here are the screen shots you requested

[ATTACH=CONFIG]23859[/ATTACH][ATTACH=CONFIG]23860[/ATTACH]
0 Kudos
MikeTschudi
Occasional Contributor
Hi Allison,

Please do check the technical article that Lindsay posted. Mark addressed the search part of the check, but there's also the display part to check:  you may be getting the parks, but they're not appearing in the results list. One cause of this is an alias name mis-match: there was a window of time where our download was updated at a different time than our information model and the alias didn't match the model.

You can test the query part of the operation by following Mark's suggestion to use Firebug. Once the page is up, open the Firebug area and choose the Net tab, and then click Clear. Search for a park by name. The first line in the Net area will be the query; if you look at its response, you'll see that it will be close to
dojo.io.script.jsonp_dojoIoScript7._jsonpCallback({"results":[]});

if nothing was found and will be a lot longer and beginning with something like
dojo.io.script.jsonp_dojoIoScript6._jsonpCallback({"results":[{"layerId":0,"layerName":"Parks and 

if there are results. With Chrome's debugger, the tab is called Network and the clear button is along the bottom with an icon consisting of a circle with a slash through it. Fiddler is another great way to see the network traffic.

Mike
0 Kudos
Allison_Laforet__Charko
New Contributor III
Hi Mike,
Thanks for the response. I plugged the site into Chrome and this is what I found when I searched by park name.
[ATTACH=CONFIG]23878[/ATTACH][ATTACH=CONFIG]23879[/ATTACH]



Searching by park activity brings back the results without any issues.
0 Kudos
MikeTschudi
Occasional Contributor
Hi Allison,

Clearly the query, then!  🙂

That's an interesting error response from the server:  a find on the MapServer generates an error, but a query on a layer in that same MapServer works.  Is your site public, or the service?

Mike
0 Kudos
BrianLord1
Occasional Contributor
okay, lets try using the chrome tools to get a little more info about what exactly is being searched for and what is being returned.

Open your site in chrome and open the developer tools just like you did previously.  This time instead of using the network tab select the sources tab.  In the top left click on the small little play button and choose the locator.js file as i did in the screenshot below.
[ATTACH=CONFIG]23887[/ATTACH]

Now scroll down in the code and find the line I have highlighted in the screenshot below and add a breakpoint by clicking on the line number on the left.
[ATTACH=CONFIG]23888[/ATTACH]

Now you can search for a park by name as usual and the app will pause at that line of code.  Using the scope variables window (shown in my screenshot) you can open the "findparams" and see exactly what parameters are being used for the find task.

Take note of the following...
layerIds, searchfields, searchtext

From there use the info you found to run the exact same find task through your arcgis services directory.  Click on the service and then scroll to the bottom of the page to select the find task and enter the search text, layer id, and search fields that you found in chrome.

This will tell you if the variables used in the find task work or if one of them needs to be changed, such as the search field.

Good Luck.
Mark
0 Kudos