Render search bar in page

Topics: Core, Customizing Orchard, General
Jul 20, 2015 at 4:17 PM
Edited Jul 20, 2015 at 4:18 PM
What would be the best way to render the native Lucene search bar in a page?

I'm trying to set up a friendly and functional 404 page that renders a search bar on the page that is already pre-populated with terms from the failed URL.

I can't use the search bar widget as this is for 404s, so there's no set URL. Currently I'm overriding NotFound.cshtml within my theme.

Thanks for your input!
Developer
Jul 20, 2015 at 5:04 PM
All you would need is a <form> element on your 404 page that looks like this:
<form method="GET" action="@Url.Action("Index", "Search", new { area = "Orchard.Search" })">
   <input type="text" name="q" />
   <button>@T("Search")</button>
</form>