Discover the Search widget

25389
65
03-06-2015 05:59 PM
MattDriscoll
Esri Contributor

There’s a new way to easily search your mapping data.

The ArcGIS JavaScript API’s new Search dijit precedes the Geocoder dijit (now deprecated). It’s been re-imagined, renamed and redesigned to provide a single searching and suggestion experience. It allows you to search across multiple Locator and Feature Layer services from a simple interface.

Whereas the Geocoder dijit’s intention was for searching only Locator tasks, the Search dijit was designed to handle multiple types of “sources,” including Locator tasks, Feature Layers and potentially more. The user interface has also been improved to handle searching one more of these sources. With the Search dijit, you can search or get suggestions from all the defined sources or a single source.

Much of the same functionality found in the Geocoder widget is also present in the Search dijit, but many new features have been added and redesigned for a better user and developer experience. As a developer, it should be easier for you to configure the Search widget and less code to write in order to handle common searching tasks. The icons for the widget use a font, so properties like the color or size can easily be modified.

New Features include:

  • Ability to search and get suggestions from Feature Layers
  • Automatically add Feature Layers from a map to the widget
  • Display additional search results to a user in the popup as “more results”
  • Highlight a result with a symbol
  • Label a result with a text symbol.
  • Results for suggestions and searches are separated and have different events
  • Optional button-mode to expand or collapse the search interface from a single button
  • Easily set an InfoTemplate to display custom popup information for a result
  • Individual placeholders for each search source... and more

Have fun exploring the demos or implementing it in your app.

65 Replies
MarshallRobinson
New Contributor III

Has this enhancement been implemented yet? I'm trying to develop a workaround to get rid of the all option, but having difficulty. Thanks.

0 Kudos
MattDriscoll
Esri Contributor

Not yet, It will be in the 3.15 release as "enableSearchingAll" option.

ElaineTaylor
New Contributor

I do not have the option of editing code (from WAB app) for deployment on our own server.

Therefore I need to know if AGOL has been updated with an option for Search deployed on multiple layer to have special text or even NO text.

We are using AGOL for a humanities project and the "Find address or place" text is confusing in the context of the project.

We have edited the Search Widget to search for names (rather than places) in multiple fields.

Thanks

0 Kudos
ElaineTaylor
New Contributor

Matt - Disregard.

I had to update the application which included swapping out the underlying map to incorporate the new data and updating the Name Search to point to the new data layer.

When I did that, the (new) wizard gave me the option of declaring the default search text for the "All" search.

Thanks to the team!

0 Kudos
DaveHighness
Occasional Contributor II

What is the source property 'exactMatch' supposed to do? I have tried changing it and I'm not noticing any difference made. I get the same suggestion list with either true or false.

The query statement stays the same.

UPPER(NAME) LIKE '%SANTA%'

It seems like the exactMatch = true option should have a query statement like this:

UPPER(NAME) LIKE 'SANTA%'

Am I missing something?

0 Kudos
MattDriscoll
Esri Contributor

exactMatch doesn't work on suggestions, just searches. (findAddressCandidates)

0 Kudos
DaveHighness
Occasional Contributor II

I think that it should. 😉

0 Kudos
MattDriscoll
Esri Contributor

I'll pass that along and see what the geocode team thinks. I think they were considering suggestions are always just partial matches since it's not a "real" search. It's just a partial search. So I don't know if a suggest that is exactMatch ever makes sense since its usually for partial matches.

0 Kudos
DaveHighness
Occasional Contributor II

In our case we are trying to use it to find city boundary polygons in a city boundary feature layer. Say we want to find "Santa Fe, New Mexico". We type in "santa fe" and we get the following list: "Eldarado Santa Fe, New Mexico", "Rancho Santa Fe, California", and "Santa Fe Springs, California". We only get "Santa Fe, New Mexico" in the list when we type "santa fe,". It seems as though "Santa Fe, New Mexico" should come up first. Any ideas on how to deal with that?

0 Kudos
MattDriscoll
Esri Contributor

Yeah, that makes sense. Feature layer suggestions are a tough cookie because each result doesn't get "weighted" with a score. What you would probably have to do is move the top results to a higher "objectid" in the feature service so that they would be showing first.

0 Kudos