4
votes

i am searching names using the wildcard query it works fine however when we do search for ascii characters it is not working well like when user search for "Hélè*", its not able to search.

note that i have already created analyzer that does ascii folding and lowercase on name field.

also its working fine when we do search in query_string. does that mean wildcard is not analyzing the ascii folding and query string does ? if yes then is there any way to achieve wildcard with ascii ?

any help will be greatly appreciated.

Thanks, Mohsin

2
If you want some help you should add some detail to your question. Your mapping, what works and what doesn't exactly.javanna

2 Answers

5
votes

Try using field query with analyze_wildcard set to true.

By default, elasticsearch doesn't try to analyze text in wildcard queries, it only lowercases it for some queries. Because of this your query is searching for all terms that start with hélè and there is no such terms in your index because of ascii folding filter.

0
votes

In Solr there is a ReversedWildcardFilterFactory and it is used at index time. When it is used if query contains wildcard character then it is not converted to ascii otherwise it is converted and searched using ascii. You can define it after ASCIIFoldingFilterFactory.

I don't know something similar exists in Lucene but you can write your FilterFactory by looking its source code.

Also you can find this document useful.