0

I do not seem to be able to get autosuggest to work with ascii folding (i.e. convert accents to their ascii equivalents)

  <DataSearch
      componentId="mainSearch"
      dataField="_name"
      categoryField="title"
      className="search-bar"
      queryFormat="and"
      placeholder="Search for movies..."
      iconPosition="left"
      autosuggest={true}
      filterLabel="search"
  />

Mapping

"_name": {
                "type": "text",
                "fields": {
                    "keyword": {
                        "type": "keyword",
                        "ignore_above": 256
                    },
                    "ascii": {
                        "type": "text",
                        "analyzer": "autosuggest_analyzer"
                    },
                    "ascii2": {
                        "type": "text",
                        "analyzer": "ngram_analyzer"
                    }
                }
            },
David Kong
  • 578
  • 1
  • 5
  • 20

1 Answers1

0

Thank you @David for reporting this.

Can you try adding ascii fields to dataField prop. dataField prop can accept either String or Array, so you can specify multiple fields there, example

<DataSearch
   dataField={["_name", "_name.ascii", ...othersIfAny]}
   ...
/>
lakhansamani
  • 101
  • 3
  • Thank you, sorry for the late response. Trying now – David Kong Dec 07 '19 at 16:42
  • This does not seem to work. I'm not sure why including both _name and _name.ascii should do anything. I really only need to search within _name.ascii, so I think including _name is superfluous. To be clear, with _name.ascii, I do get the right results when searching; however, the autocomplete does not work. Any help or documentation relating to how the autosuggest function works would be great (for example, before I even add the autosuggest_analyzer and ngram_analyzer, the autosuggest works - that is confusing to me)\ – David Kong Dec 07 '19 at 17:01
  • @DavidKong have you tried adding `_name. ascii2` to your dataField list? Also, it would be great, if you can share codesandbox for the same. It will help me better to understand the problem. – lakhansamani Dec 09 '19 at 07:58