Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mark Evans 86 posts 116 karma points
    Aug 01, 2014 @ 10:03
    Mark Evans
    0

    Creating a site search

    im fairly new to umbraco (and mvc) so busy learning both while developing a new website. my current task is adding a search functionality to the site. i am planning to use the examine indexer.

    i have created a search model with a searchterm property and created my searchbox as a partial view that can be included in my layout structure page.

    @model Models.SearchModel

    @using (Html.BeginUmbracoForm("SearchResults", "SearchSurface", null, new { @class = "search-form", @enctype = "multipart/form-data" }))

    {    
        @Html.TextBoxFor(x => x.SearchTerm,  new{ @id = "search", @name="search", @placeholder="Search" })      <input type="submit" value="Search" class="btnSubmit" />  
    }

    However when i include this in my layout page 

    <div class="grid_8">                  

    @{ Html.RenderPartial("SearchBox"); } 

    </div>

    i get an error :-

    The model item passed into the dictionary is of type 'Umbraco.Web.Models.RenderModel', but this dictionary requires a model item of type 'Models.SearchModel'.

     

    how should i be trying to render this search box in my layout page?

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Aug 01, 2014 @ 10:29
    Dennis Aaen
    0

    Hi Mark,

    Maybe you should have a look at the ezsearch package. ezSearch is the easy search solution for your Umbraco MVC websites. It's fast, self contained and completely configurable.

    http://our.umbraco.org/projects/website-utilities/ezsearch

    Maybe this could be a good solution for you.

    Hope this helps,

    /Dennis

     

  • Mark Evans 86 posts 116 karma points
    Aug 01, 2014 @ 10:34
    Mark Evans
    0

    thanks i have done i wanted to try and have more control over the search results like what nodes to include and what to boost etc....

    i dont think its too tricky as i can handle the form submit in my controller and pass a pagedlsit to my view.... 

     

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies