<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Search Widget 4.25 - 'Deep' searching feature layer attributes? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-4-25-deep-searching-feature-layer/m-p/1234281#M79420</link>
    <description>&lt;P&gt;Hello Javascripters,&lt;/P&gt;&lt;P&gt;I'm having a slight issue with the newest JSAPI (4.25) search widget and wondering if I'm missing something.&amp;nbsp; The 'what's new' documentation says that:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;In order to make the&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html" target="_blank"&gt;Search widget&lt;/A&gt;&amp;nbsp;faster and more efficient with a&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LayerSearchSource.html" target="_blank"&gt;layer-based source&lt;/A&gt;, we removed the leading wildcard in layer-based source searches...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;This is causing issues with searching beyond the first word in an attribute column.&amp;nbsp; For example, I have a sentence stored in a column that I'm searching on...'The Elk Horn Lodge...' is how it begins.&amp;nbsp; Can cannot get results for anything but 'The' in the search box.&amp;nbsp; There doesn't seem to be anything obvious to undo this new 'enhancement'.&lt;/P&gt;&lt;P&gt;In 4.24, searches for 'Elk', 'Lodge' or anything else that was in the attributes worked fine.&lt;/P&gt;&lt;P&gt;Any help would be great.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 22 Nov 2022 20:56:29 GMT</pubDate>
    <dc:creator>MichaelSnook</dc:creator>
    <dc:date>2022-11-22T20:56:29Z</dc:date>
    <item>
      <title>Search Widget 4.25 - 'Deep' searching feature layer attributes?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-4-25-deep-searching-feature-layer/m-p/1234281#M79420</link>
      <description>&lt;P&gt;Hello Javascripters,&lt;/P&gt;&lt;P&gt;I'm having a slight issue with the newest JSAPI (4.25) search widget and wondering if I'm missing something.&amp;nbsp; The 'what's new' documentation says that:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;In order to make the&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html" target="_blank"&gt;Search widget&lt;/A&gt;&amp;nbsp;faster and more efficient with a&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LayerSearchSource.html" target="_blank"&gt;layer-based source&lt;/A&gt;, we removed the leading wildcard in layer-based source searches...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;This is causing issues with searching beyond the first word in an attribute column.&amp;nbsp; For example, I have a sentence stored in a column that I'm searching on...'The Elk Horn Lodge...' is how it begins.&amp;nbsp; Can cannot get results for anything but 'The' in the search box.&amp;nbsp; There doesn't seem to be anything obvious to undo this new 'enhancement'.&lt;/P&gt;&lt;P&gt;In 4.24, searches for 'Elk', 'Lodge' or anything else that was in the attributes worked fine.&lt;/P&gt;&lt;P&gt;Any help would be great.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 20:56:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-4-25-deep-searching-feature-layer/m-p/1234281#M79420</guid>
      <dc:creator>MichaelSnook</dc:creator>
      <dc:date>2022-11-22T20:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget 4.25 - 'Deep' searching feature layer attributes?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-4-25-deep-searching-feature-layer/m-p/1234375#M79422</link>
      <description>&lt;P&gt;This is my least favorite change with 4.25 thus far.&amp;nbsp; The Search widget has used "contains" logic for many years, and to suddenly change it up to "starts with" logic without some kind of means by which we can turn it on or off (like a configuration parameter or something) is a bit of a curveball out of nowhere.&lt;/P&gt;&lt;P&gt;Anyhow, the heart of the workaround I've devised for 4.25 intercepts the process where the associated layer's &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#queryFeatures" target="_self"&gt;queryFeatures&lt;/A&gt; function is called, and "fixes" the where clause.&amp;nbsp; It looks something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var source = new LayerSearchSource(options);
source.layer.defaultQueryFeatures = source.layer.queryFeatures;
source.layer.queryFeatures = function(query) {
	if ((query) &amp;amp;&amp;amp; (typeof query.where == "string"))
		query.where = query.where.replace(/ LIKE '/g, " LIKE '%");

	return this.defaultQueryFeatures.apply(this, arguments);
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that "LayerSearchSource" is&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LayerSearchSource.html" target="_self"&gt;esri/widgets/Search/LayerSearchSource&lt;/A&gt;.&amp;nbsp; Note also that there are some unlikely cases where this could cause unintended side effects, because &lt;U&gt;any time&lt;/U&gt; the layer's queryFeatures function is called, any instances of " LIKE '" in the query's &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#where" target="_self"&gt;where&lt;/A&gt; property will be changed to " LIKE '%"...so you might consider how the layer object is being used, and if other functionality executes LIKE-based queries.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My workaround for 3.42 is "somewhat" cleaner in that the where clause is only altered for queries executed by the widget itself:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var search = new Search(options, srcNode);
search._defaultWhereClause = search._whereClause;
search._whereClause = function() {
	var wc = this._defaultWhereClause.apply(this, arguments);

	return ((typeof wc == "string") ? wc.replace(/ LIKE '/g, " LIKE '%") : wc);
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 00:50:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-4-25-deep-searching-feature-layer/m-p/1234375#M79422</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2022-11-23T00:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget 4.25 - 'Deep' searching feature layer attributes?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-4-25-deep-searching-feature-layer/m-p/1234510#M79429</link>
      <description>&lt;P&gt;Thanks Joel...this will definitely give me a start on duct-taping the widget!&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 14:55:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-4-25-deep-searching-feature-layer/m-p/1234510#M79429</guid>
      <dc:creator>MichaelSnook</dc:creator>
      <dc:date>2022-11-23T14:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget 4.25 - 'Deep' searching feature layer attributes?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-4-25-deep-searching-feature-layer/m-p/1236942#M79524</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2691"&gt;@MichaelSnook&lt;/a&gt;&amp;nbsp; here's another alternative approach I found with the 4.x api - it basically uses the esri request interceptors to intercept matching /query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const log = debug('interceptors');

// fix the search query issue
esriConfig.request.interceptors.push({
    urls: /\/query/,
    before({ requestOptions }) {
        if (/LIKE '[^%]/g.test(requestOptions.query?.where)) {
            log('like request intercepted', requestOptions);
            requestOptions.query.where = requestOptions.query.where.replace(/ LIKE \'/g, ' LIKE \'%');
        }
    }
})&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 01 Dec 2022 19:35:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-4-25-deep-searching-feature-layer/m-p/1236942#M79524</guid>
      <dc:creator>GreggRoemhildt2</dc:creator>
      <dc:date>2022-12-01T19:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget 4.25 - 'Deep' searching feature layer attributes?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-4-25-deep-searching-feature-layer/m-p/1497508#M84928</link>
      <description>&lt;P&gt;This should also be sufficient&lt;/P&gt;&lt;P&gt;layerSearchSource.prefix = "%";&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 08:46:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-4-25-deep-searching-feature-layer/m-p/1497508#M84928</guid>
      <dc:creator>MRietveld</dc:creator>
      <dc:date>2024-06-26T08:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget 4.25 - 'Deep' searching feature layer attributes?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-4-25-deep-searching-feature-layer/m-p/1699250#M88396</link>
      <description>&lt;P&gt;Another possible way may be using full-text-index in combination with searchWidgets exactMatch = false property.&lt;BR /&gt;Unfortunately it only seems to change from a "field-start-with"-condition to "any-word-in-field-starts-with".&lt;BR /&gt;&lt;BR /&gt;Lets say a features name is&amp;nbsp; "My SearchField" then searching by "Search" would work since "SearchField" is a word inside the field and starts with the searchterm "Search".&lt;BR /&gt;While searching by "Field" would not work since "SearchField" is still a work in the field but does not start with the search termn "Field"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use the interceptor and set a breakpoint.&lt;BR /&gt;The interceptor is simply placing a '%' infront of the search term.&lt;/P&gt;&lt;P&gt;Suprisingly, right before doing the interceptors magic the request options already do contain a like with % before and after the search term. Unfortunately is still does not&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Any ideas on what is still going wrong?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SebastianKrings_0-1777546365837.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/151771iAFE2C22D13C05209/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SebastianKrings_0-1777546365837.png" alt="SebastianKrings_0-1777546365837.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;We are using 4.34&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2026 11:03:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-4-25-deep-searching-feature-layer/m-p/1699250#M88396</guid>
      <dc:creator>SebastianKrings</dc:creator>
      <dc:date>2026-04-30T11:03:39Z</dc:date>
    </item>
  </channel>
</rss>

