如何做模糊检索在Lucene.net在asp.net? [英] how to do fuzzy search in Lucene.net in asp.net?

查看:130
本文介绍了如何做模糊检索在Lucene.net在asp.net?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经创造lucene.net索引和搜索基于此网址 http://sonyblogpost.blogspot.in/。 。但是我们要像进行输出

we have creating lucene.net index and search based on this URL http://sonyblogpost.blogspot.in/. but we want the output like follow.

例如:如果我搜索精选
I想显示相关术语,如精选,特色,功能。

example: if i search "featured" i want to show related terms like "featured","featuring","feature".

任何人都可以帮助我。
的感谢。

Anyone can help me. thanks.

推荐答案

要执行,您将创建一个模糊搜索一个 MultiFieldQueryParser 下面是如何做到这一点的例子:

To perform a Fuzzy search you'll create a MultiFieldQueryParser Below is an example on how to do this:

var parser = new MultiFieldQueryParser(Lucene.Net.Util.Version.LUCENE_29, new[] { "field1", "field2" }, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));

您Lucene.Net版本可能会有所不同。

Your version of Lucene.Net may vary.

接下来你会得到这样的解析器的模糊查询:

Next you will get a Fuzzy query from the parser like this:

var query = parser.GetFuzzyQuery("fieldName", "featured", 0.7f);



0.7f 的浮点值是最小相似度。直到你得到想要的结果,你可以调整这个数字。数量不能超过 1.0F 更多。执行使用Lucene的搜索器会给你你所期望的结果此查询。

The float value of 0.7f is the minimum similarity. You can tweak this number until you get the desired results. The number cannot be more than 1.0f. Executing this query using an Lucene Searcher will give you the results you expect.

这篇关于如何做模糊检索在Lucene.net在asp.net?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆