Search Widget using Arabic Word

763
5
04-30-2019 06:21 AM
MayurPatel
New Contributor II

Hi,

I am using ArcGIS JavaScript API 4.10. I have implemented the search widget in my application. I am able to search feature using English words but when I am trying to search using Arabic word, I got 'No results found' in suggestion Template. I have set below two properties for Search Widget

searchFields: ["NAMEENGLISH", "NAMEARABIC"],

suggestionTemplate: "{NAMEENGLISH}, {NAMEARABIC}",

 1. Search using English Characters(Musaffah)

2. Search using Arabic Characters(مصفح)

I am not getting suggestion for the Arabic Case. Any help here. 

Tags (2)
0 Kudos
5 Replies
MahmoudHemdan2
Esri Contributor

Hi, to solve this issue should be done following item

1. try to hosting the Esri Javascript API locally.

2. go to the "search.js" in this path "https://<your machine>/arcgis_js_api/library/3.27/3.27/esri/dijit/search.js" and open it in the editor.

3. go to the method "_whereClause"

4. change this line from

'this.reHostedFS.test(b.url) && this._containsNonLatinCharacter(a) &&(f = "N");'

to

'this._containsNonLatinCharacter(a) && (f = "N");'.

5.check now will be solved.

0 Kudos
Noah-Sager
Esri Regular Contributor

A word of caution, we do not recommend or allow people to modify the JS API. Please see our policy here:

Frequently Asked Questions | ArcGIS API for JavaScript 4.13 

0 Kudos
Noah-Sager
Esri Regular Contributor

I tested a sample using Arabic localization, it seems to give suggestions.

https://codepen.io/noash/pen/KKKaaOP 

Are you searching a layer, a custom Locator source, or using the Esri world geocoding service?

0 Kudos
MohammedZaki
New Contributor III

@Noah-Sager I'm facing the same issue searching in a LayerSearchSource. It is registered in GDB.

I test in ArcGIS Pro and it returns results only if I added N before searchTerm like "where field=N'text'"

How can I add it to the code?

 

  addsearchSource(
    layer: FeatureLayer,
    allowedFields: string[],
    placeholder: string
  ) {
    const source = new LayerSearchSource({
      layer: layer,
      searchFields: allowedFields ? allowedFields : ['*'],
      exactMatch: false,
      outFields: allowedFields ? allowedFields : ['*'],
      placeholder: placeholder.slice(0, 20) + '...', // trim long placeholderes
      name: layer.title,
      zoomScale: 500000,
    });

    this.searchWidget.sources.add(source);
  }
0 Kudos
MohammedZaki
New Contributor III

Find the solution in this thread

0 Kudos