开发者

Hibernate Search 3.3- Ignore IntraWord whitespace

I am using hibernate search 3.3 in my application.

My Search Form has text fields, dropdown, listbox and so on. I have to perform search on words, numbers and dates. Basically a multifield Search.

My problem is that I am not able to perform a Search on words with intra-word whitespace.

For example: The list box has a set of Employee names which allows multi select. So in my Java layer, I would be getting values in an array li开发者_高级运维ke - [Ankita Murthy, Ahana Gupta, Archita Patel]

Now, I have to separate these names on comma and match these names against employee_name column in database and retrieve results. Because of the intraword whitespace, match is failing.

I did a bit of research and found out that we can alter Analyzers to achieve this but I am not able to understand that.

Also guide me on altering the Analyzers to make them ignore upper/lower case


The best is to use disjunction to make an OR, ilike to avoid sensitivity, and MatchMode.ANYWHERE to fidn the value anywhere in the values of the DB.

You can try with or without MatchMode;however, it has various other types that are start, end and exact.

Disjunction dis = Restrictions.disjunction();

dis.add(Restrictions.ilike("employee.name",value1,MatchMode.ANYWHERE);
....
criteria.add(dis);

Check this out

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜