We recently enhanced the Search widget in that you will see across all web apps like Map Viewer, Map Viewer Classic, Instant Apps, Experience Builder and Web AppBuilder. The recent change to the Search widget can return faster results more efficiently and maintain stability for the layers being used to search for features. The layer-based search performance benefits increase as the number of features increase, the searched term character count length increases, and the field being searched also has more data along with repeated searches.
Updates Made to Search Widget
Using Full-Text field indexes for layer-based feature searches with ArcGIS Online hosted feature layers.
First off you are probably asking – What is a Full-text field index?
This type of index is created when you author a feature search under the application settings of a web map or in the instant apps layer-based search configuration. When the index is created essentially it will take the field specified in the search configuration and then scan the data in the field and tokenize the words within each row. Which pretty much means behind the scenes we are splitting up the data in the field into smaller units, such as individual words or terms that will improve the overall search performance.
Search is configured on layer with all the US Post Offices and using the Name field. An example result on the name field is Highlandtown Station Baltimore Post Office. The index will split up this example into these searchable terms Highlandtown Station Baltimore Post Office. This will make all the the terms now searchable with the full-text index where you could search Baltimore Office, Highland Baltimore, Stat Balt Office and be able to retrieve this feature from the search results.
How does the Search widget use these indexes?
The Search widget will now leverage Full-Text field indexes on hosted feature layers layer-based source searches. The index automatically gets generated when feature search is authored on a field for a hosted feature layer in web maps authored after the November 2022 release. You can update existing maps or create new ones to generate these indexes, so if this index type exists on the field being searched the widget will use it automatically. The search type being used in the search widget is called prefix. This will query the field with the characters searched and return results for words that begin with the specified text. These indexes greatly improve performance and stability especially with large search terms which we have seen with our testing take sub second vs. the double wildcard taking over ten seconds (more on the wildcard changes below). You can see an example of this prefix query in the above example Stat Balt Office where the prefix search is used to find Station, Baltimore and then a complete term Office. However, searched for More you would not get results for Baltimore.
Remove the leading wildcard for layer-based feature searches.
When searching for features using the Contains layer-based search and for suggested results on Equals the search widget in previous releases would send the searched for term using the LIKE operator and a % wildcard on each side of the term. This would then go through the field set in the layer-based feature search and try and match that character pattern with all the data in the field. This becomes a very heavy query when the number of characters in the search term increases the amount of data that has to be scanned in each row and the number of rows that exist. Eventually this could cause issues for your content as traffic increases, the number of features that exist increases and more searches are performed on your data.
Search is configured on the layer Post Office and using the field Name on a layer with NO Full-Text Index. When searching for Highlandtown Station Baltimore Post Office the entered search text would have to now start with Hig to start returning results that begin with Hig and Highlandtown Station Baltimore Post Office falls within that searched character pattern and could be a returned result. This is because the leading wildcard is not used, and the query becomes “starts with”. The change will not support being able to search for other character patterns that could happen elsewhere in the string like searching for example searching Baltimore will not return Highlandtown Station Baltimore Post Office but would return any results that start with Baltimore.
First off – I hope this blog helps you understand the recent changes we made to searching for features. We want to bring you faster results and stability to your content. Up next we have plans for bringing the Search authoring experience into Map Viewer. This will make building and trying out your searching you author easier and faster. We also have plans to expose the indexes that exist on you’re layers to make it easier to understand what indexes exist and give you additional controls there. Please leave feedback here in the blog post or reference this blog if you have any questions in the Esri Community.