我想知道在MVC3中创建站点搜索的最好方法是什么。我希望能够以某种方式索引我所有的静态.cshtml视图文本,并使其可搜索。
我搜索了一下,认为IndexTank可能是可行的,但它似乎是最近获得的,不再支持它。
我是MVC的新手,所以最简单的路线就是我想要的。:)
谢谢!
发布于 2012-04-17 00:11:03
将静态内容移动到资源文件,然后使用类似Lucene.net的命令在资源文件上进行搜索
下面是一个使用http://www.ifdefined.com/blog/post/2009/02/Full-Text-Search-in-ASPNET-using-LuceneNET.aspx的人的例子
发布于 2012-04-17 00:04:23
最简单的解决方案是在你的网站中嵌入一个谷歌搜索框,只搜索你的域名。
<!-- SiteSearch Google -->
<form method="get" action="http://www.google.com/search">
<label for="q">Search:</label>
<input id="q" name="q" size="20" maxlength="255" value="" type="text"/>
<input name="domains" value="http://www.mydomain.com/" type="hidden"/>
<input name="sitesearch" value="http://www.mydomain.com/" checked="checked" id="mysite" type="radio"/>
<label for="mysite">Just this site</label>
<input name="sitesearch" value="" id="www" type="radio"/>
<label for="www">WWW</label>
<input name="btnG" value="Go" type="submit"/>
</form>
<!-- SiteSearch Google -->https://stackoverflow.com/questions/10177485
复制相似问题