java - How can I search a keyword in Hibernate Search with definite article? -


i'm using hibernate search dsl make query , need search keyword in french.

for example, when use query:

query query = querybuilder.keyword().onfield("normval").matching("asthme").createquery(); 

it matches word asthme on field "normval", want query can find word "l'asthme" or "d'asthme" too.

is know how can in hibernate search?????????

you can use matching method wildcard characters in string: ? represents single character , * represents character sequence

so code, example, be:

 query query = querybuilder.keyword().onfield("normval").matching("*asthme*").createquery(); 

you can find more details here

edit after op comment

if have fixed values search, words articles, can try instead of wildcars:

query query = querybuilder.bool() .should(querybuilder.keyword().onfield("normval").matching("l'asthme").createquery()) .should(querybuilder.keyword().onfield("normval").matching("d'asthme").createquery()) .should(querybuilder.keyword().onfield("normval").matching("asthme").createquery()) .createquery(); 

please notice should method work or query operator


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -