简体   繁体   English

对我的网站(C#ASP.net)进行快速且相关的搜索

[英]Implementing a fast and relevant search for my site (C# ASP.net)

My site has a database of widgets, each widget has a name and description. 我的站点有一个小部件数据库,每个小部件都有一个名称和描述。 I want to implement a fast and relevant search system on my site, how do I do this? 我想在我的网站上实施快速且相关的搜索系统,该怎么做?

As a side note, I also implemented tags on those widget. 附带说明一下,我还在这些小部件上实现了标签。 Here is how I implemented (Tell me what you think): 这是我的实现方式(告诉我您的想法):

Table widgets: has unique id plus other info for a widget Table tag_words: Has unique ID and of course, the tag Table tag-widget: Join table that associates a tag to a widget 表小部件:具有唯一ID以及小部件的其他信息表tag_words:具有唯一ID,当然还有标签Table tag-widget:将标签与小部件相关联的联接表

I've created indexes on both all those columns to make search as fast as possible. 我在所有这些列上都创建了索引,以使搜索尽可能快。

If you're using SQL Server, you can utilize full-text search . 如果您使用的是SQL Server,则可以使用全文本搜索 As for the tags, that's the best way for a small to medium site. 对于标签,这是中小型网站的最佳方法。 StackOverflow denormalizes the tagging for faster reads, but for your app I would probably avoid that. StackOverflow对标签进行非规范化以加快读取速度,但是对于您的应用程序,我可能会避免这种情况。

Lucene.NET is an alternative if you can't use the built-in full-text search from your database. 如果无法从数据库中使用内置的全文本搜索,则可以使用Lucene.NET It also gives you better control over what and how things are indexed. 它还使您可以更好地控制对内容进行索引的方式和方式。

Reading your side note about tags, I think I would really use Lucene.NET. 阅读有关标签的旁注,我认为我真的会使用Lucene.NET。 It will give allow you to decide how to rank the tags in relation to everything else whereas I don't know if that is possible with SQL Server's full text search. 它可以让您决定如何相对于其他所有内容对标记进行排名,而我不知道使用SQL Server的全文本搜索是否可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM