Hibernate Search 3.3-忽略字内空格
我在我的应用程序中使用 hibernate search 3.3。
我的搜索表单有文本字段、下拉列表、列表框等。我必须对单词、数字和日期进行搜索。基本上是多字段搜索。
我的问题是我无法对带有单词内空格的单词执行搜索。
例如:列表框有一组允许多选的员工姓名。因此,在我的 Java 层中,我将在数组中获取值,例如 - [Ankita Murthy、Ahana Gupta、Archita Patel]
现在,我必须用逗号分隔这些名称,并将这些名称与数据库中的employee_name 列进行匹配并检索结果。由于字内空格,匹配失败。
我做了一些研究,发现我们可以改变分析器来实现这一点,但我无法理解这一点。
还指导我更改分析器,使它们忽略大写/小写
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 like - [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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最好是使用析取来进行 OR,这样可以避免敏感性,并使用 MatchMode.ANYWHERE 来查找数据库值中任意位置的值。
您可以尝试使用或不使用 MatchMode;但是,它还有各种其他类型,包括开始、结束和精确。
看看这个
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.
Check this out