cardiac7
cardiac7

Reputation: 491

MVC 3 - Best method to create a search on my 'Views'

I am wondering what the best way to create a site search is in MVC 3. I would like to be able to somehow index all of my static .cshtml view text and have it be searchable.

I have searched around a bit and thought that IndexTank might be the way to go but it seems that it was recently acquired and no longer supported.

I am pretty new to MVC so the easiest route is what I am after here. :)

Thanks!

Upvotes: 3

Views: 1454

Answers (2)

Bob The Janitor
Bob The Janitor

Reputation: 20802

Move your static content to Resource files and then do the search on the resource files using something like Lucene.net

here is an example of someone using it http://www.ifdefined.com/blog/post/2009/02/Full-Text-Search-in-ASPNET-using-LuceneNET.aspx

Upvotes: 1

Kyle Nunery
Kyle Nunery

Reputation: 2049

The simplest solution would be to embed a Google search box in your website that only searches your domain.

<!-- 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 -->

Upvotes: 3

Related Questions