实现使用ASP.NET MVC一个搜索框,SQL Server中,实体框架 [英] Implementing a Search Box using ASP.NET MVC, SQL Server, Entity Framework

查看:149
本文介绍了实现使用ASP.NET MVC一个搜索框,SQL Server中,实体框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有经验建立一个搜索解决方案,但我想有我的解决方案中的一个搜索框,我不知道在哪里甚至开始。是否有冷静,我可以使用,使我的搜索解决方案,高性能(我使用托管SQL 2008服务器)我很想指针启动我带过一个简单的查询搜索解决方案的多步教程SQL Server的技巧..然后。而更先进的code和功能层。

I have no experience building a search solution, but I'd like to have a search box within my solution and I don't know where to even begin. Are there cool SQL Server tricks that I can use to make my search solution performant (I'm using a hosted SQL 2008 server) I'd love pointers to a multi-step tutorial that starts me off with a simple query search solution...and then layers on more advanced code and features.

推荐答案

其实你不说你是否需要/想有一个蜘蛛来索引你的网站现况(如谷歌,如果你的搜索这是有用的每个页面上的内容来自许多不同的表/对象/实体),还是你只是想使用全文搜索的语法返回实体的集合查询EF?

You don't actually say whether you need/want a 'spider' to index your site "as is" (like Google; which is useful if your searchable content on each page comes from many different tables/objects/entities) or whether you just want to query EF using full-text-search-like syntax to return a collection of Entities?

如果你是在'蜘蛛'的做法有趣的 - 这里有一个小ASP.NET搜索引擎一个$ C $的CProject文章的 Searcharoo 。这是一个网页检索的搜索引擎对小十岁上下的网站(它不使用数据库的话),所以它可能不适合您的情况。
在code也是在 searcharoo。codeplex.com 并有7篇它如何工作/始建于 Searcharoo.net (声明:我写了他们,我希望他们是有趣/有用)。

If you are interesting in the 'spider' approach - here's a CodeProject article for a small ASP.NET Search Engine "Searcharoo". It is a web-crawling search engine for small-ish sites (it doesn't use a database at all), so it may not be applicable for your situation. The code is also at searcharoo.codeplex.com and there are 7 articles on how it works/was built at Searcharoo.net (disclaimer: I wrote them; I hope they are interesting/useful).

如果您需要直接搜索你的数据库,你应该看看SQL Server 2008中的全文搜索功能(假设 LIKE 不是你的需求不够完善)。我们使用来自一>,以建立SQL全文在工作项目搜寻......在我们的解决方案没有EF虽然。

If you need to search your database directly, you should probably look into SQL Server 2008's Full Text Search feature (assuming LIKE isn't sophisticated enough for your needs). We used info from this article (free registration) to set-up SQL Full Text Search on a work project... no EF in our solution though.

另外,你可能知道的StackOverflow是建立与ASP.NET MVC - 他们的博客上讲述一些的与SQL 2008 FTS 问题。还有<一个href=\"http://stackoverflow.com/questions/499247/sql-server-2008-full-text-search-fts-versus-lucene-net\">some帮助在SQL FTS与Lucene.NET(这是可以研究的另一个搜索引擎),可能是有益的。

Also, as you might know StackOverflow is built with ASP.NET MVC - they blogged about some problems with SQL 2008 FTS. There's also some info on SQL FTS versus Lucene.NET (which is another search engine you could research) that might be useful.

这篇关于实现使用ASP.NET MVC一个搜索框,SQL Server中,实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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