Search functionality

Topics: Developer Forum, User Forum
Oct 27, 2008 at 3:34 PM
Hi, i'm new to N2 and i need help to impliment a search function in the header.
Pretty standard stuff the user will type keywords into a free text box and click search,
then N2 will search all the content and bring back a list of pages that include the search keywords.

Any help on this would be really appriciated, i have been through the examples and can't find this anywhere.

Thanks in advance

Nov 1, 2008 at 6:18 PM
I'd start implementing this in the master page. You can take a look at the master page in the functional templates. There's also a search function you can look at. I'd probably pick up the search string and redirect to a search page with a query string. Then I would use that querystring to search.
Oct 20, 2011 at 1:12 PM

Want to do the same thing. But where I should store URL of the search page results, and how to get that URL when I'm adding a quick search form? 

    <form action="" method="GET">
           @Html.TextBox("q", "", new { placeholder = Content.Translate["Search"], autocomplete = "off" })

Oct 25, 2011 at 10:30 PM

You can use  @Url.Action to a controller that handles this. If you have a specific page that displays results you can store a reference to it somewhere and use @searchPage.Url in the action attribute.