如何使用 Lucene.NET 构建自动完成/建议?

发布于 2024-08-22 02:03:59 字数 33 浏览 10 评论 0原文

如何使用 Lucene.NET 构建自动完成/建议?

How-to build AutoComplete / Suggestions with Lucene.NET ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

千と千尋 2024-08-29 02:03:59

这里的回复非常简单,它会帮助您开始。

SpellChecker 项目是 lucene.net contrib 的一部分,将为您提供 Google 的“您是说吗?”像功能一样,检查一下。

对于自动完成,您可以在文本查询末尾附加一个 *。所以 ja* 将返回 java、jack、jane 等。此外,*va 将返回 java、lava 等(尽管您必须明确允许前导通配符)

希望这会有所帮助

Very simple response here, it'll get you started.

The SpellChecker project, which is part of lucene.net contrib, will give you Google's "Did you mean?" like functionality, check that out.

For AutoComplete, you could append an * at the end of the text query. So ja* would return java, jack, jane, etc. Also, *va would return java, lava, etc (although you have to explicitly allow leading wildcards)

hope this helps

玩世 2024-08-29 02:03:59

创建一个包含进入您的应用程序的所有搜索查询的数据库。 (查询日志)

创建一个具有相似字段的表

QueryText varchar(x)
Occurence int

,然后进行搜索,其中查询文本以用户正在搜索的内容开头,并按出现次数降序排列。

其中 QueryText LIKE 'some text%' ORDER BY Occurence DESC

create a database of all search queries coming into your application. (query log)

create a table that has similar fields

QueryText varchar(x)
Occurence int

then do a search where the query text starts with what the user is searching for and order by the occurrence descending.

where QueryText LIKE 'some text%' ORDER BY Occurence DESC
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文