c# - MVC 3 - 在我的 'Views' 上创建搜索的最佳方法

标签 c# .net asp.net-mvc-3 search

我想知道在 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/

相关文章:

c# - 为什么 Xml 文档的 selectSingleNode 有空值?

asp.net-mvc - 获取 MVC3 中选中复选框的 ID

c# - 迁移 "Legacy"SQLite 数据库以使用 Entity Framework 时的主键问题

.net - 将 System.Array 从 .Net 编码到 vb6

c# - Linq2Sql - 尝试更新但 sql 中的 Set 语句为空

asp.net-mvc - MVC HTML.RenderAction – 错误 : Duration must be a positive number

asp.net-mvc-3 - MVC3 强类型局部 View 模型绑定(bind)

c# - 将扁平化的分层数据转换为树结构的 JSON

C# - 读取/复制/替换文本中的行

c# - XDocument.XPathSelectElements : I can't seem get the xpath syntax right