lucene - How to use analyzer in Hibernate Search? -
when utilize infinispan hibernate, need utilize analyzer find results includes key word.
but when search keyword sno_no_d6-11100
query like:
querybuilder querybuilder = csecore.searchmanager .buildquerybuilderforclass(hierarchy.class).get(); query query = querybuilder .keyword().onfield("path").matching("sno_no_d6-11100").createquery();
it seperatessno_no_d6-11100
sno_no_d6
, 11100
find them respectively , merge 2 results together. there results incorrect.
if ignore analyzer, find exact match incorrect. there solution analyzer can ignore "-" ??
try phrase query (see section 5.1.2.4 in hibernate query dsl) instead:
query query = querybuilder.phrase().onfield("path").sentence("sno_no_d6-11100").createquery();
the 2 terms still separated, since phrase query search 2 separate terms occurring consecutively. not able distinguish between "sno_no_d6-11100" , "sno_no_d6 11100", i'm guessing acceptable.
hibernate lucene hibernate-search infinispan
No comments:
Post a Comment