复杂短语查询解析器
我想使用 Hibernate Search 为我的网站实现模糊短语搜索。我从一些人那里读到,ComplexPhraseQueryParser 可以解决这个问题。
但问题是我有一些误解或与之相关的问题。
例如,让我们考虑这样一个测试标题(我有很多这样的标题,我需要让用户搜索他们喜欢的任何内容):
“你知道如何保持身材吗?”
如果有人会输入 “你知道如何保持身材吗?”我的 ComplexPhraseQueryParser 将找不到任何内容。但是,如果我在拼写错误的单词(如“cnow~”)后面放置一个“~”字符,它将起作用并返回结果。
这是什么原因呢? ComplexPhraseQueryParser 不支持这种情况吗?
我想让我的搜索处理一些拼写错误的单词并返回结果(类似于谷歌搜索)。
ComplexPhraseQueryParser quizTitlePhraseQuery = new ComplexPhraseQueryParser(Version.LUCENE_30, "title", new StandardAnalyzer(
Version.LUCENE_30)) ;
quizTitlePhraseQuery.setPhraseSlop(100);
quizTitlePhraseQuery.setDefaultOperator(Operator.AND);
quizTitlePhraseQuery.setFuzzyMinSim(0.1f);
先感谢您!
I would like to implement for my website a fuzzy phrase search using Hibernate Search. I've read from some people that ComplexPhraseQueryParser is ok for this.
But the thing is that I have some missunderstandings or issues related to it.
So for instance let's consider a test title like this (I have a lot of this and I need to let users search whatever they like):
"Do you know how to be in shape?"
If someone will type
"do you cnow how to be in shape?" my ComplexPhraseQueryParser will not find anyting. But if I put a "~" character after the misspeled word like "cnow~" it will work and return a result.
What is the reason of this? Doesn't ComplexPhraseQueryParser support such situations?
I would like to make my search deal with few misspelled words and return results (similar to google search).
ComplexPhraseQueryParser quizTitlePhraseQuery = new ComplexPhraseQueryParser(Version.LUCENE_30, "title", new StandardAnalyzer(
Version.LUCENE_30)) ;
quizTitlePhraseQuery.setPhraseSlop(100);
quizTitlePhraseQuery.setDefaultOperator(Operator.AND);
quizTitlePhraseQuery.setFuzzyMinSim(0.1f);
Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论