我想知道在 MVC 3 中创建站点搜索的最佳方法是什么。我希望能够以某种方式索引我所有的静态 .cshtml View 文本并使其可搜索。
我四处搜索了一下,认为 IndexTank 可能是可行的方法,但它似乎最近被收购并且不再受支持。
我是 MVC 的新手,所以最简单的方法就是我在这里追求的。 :)
谢谢!
最佳答案
最简单的解决方案是在您的网站中嵌入一个仅搜索您的域的 Google 搜索框。
<!-- 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 -->
关于c# - MVC 3 - 在我的 'Views' 上创建搜索的最佳方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10177485/