Hibernate Search Turkish Character

299 views Asked by At

I am trying to search a field filled with Turkish characters. For example: Müdürlük. But when I try to query this field not able to get results. I am new to hibernate search. What should I do?

1

There are 1 answers

0
yrodiere On BEST ANSWER

There may be other problem (I can't tell without the code), but one thing you'll probably want is to use a language-specific analyzer, so that "mudurluk" will match "Müdürlük" for instance, or so that "istanbul" will match "İstanbul" (capital dotted "i").

To do that with Hibernate Search using annotations, fill in the analyzer attribute of your @Field annotation:

@Field(analyzer = @Analyzer(impl = org.apache.lucene.analysis.tr.TurkishAnalyzer.class))
String myProperty;

If you mapped your entity using the programmatic API, the process should be fairly similar.

Please see the official documentation for more details about analyzers in Hibernate Search: https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#_analyzer

EDIT: don't forget to reindex your data after you changed the analyzer.