Copied to clipboard

Flag this post as spam?

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


  • Chris Mahoney 235 posts 447 karma points
    Dec 06, 2022 @ 02:42
    Chris Mahoney
    0

    Examine search: Do I need to disable ModelsBuilder somehow?

    I'm trying to update an old site from Umbraco 7 to 11, and I'm trying to move the search function over to Examine. I'm using the quick start guide at https://docs.umbraco.com/umbraco-cms/reference/searching/examine/quick-start.

    I have an existing page called Search which is intended to display search results, and it has a document type behind it called Search Page.

    I've copied most of the code from the quick start documentation onto my site, changing references to People over to Search. Everything compiles, but when I try to view the results page I get the following error:

    ModelBindingException: Cannot bind source content type Umbraco.Cms.Web.Common.PublishedModels.SearchPage to model type MySite.Models.SearchViewModel. The source is a ModelsBuilder type, but the view model is not. The application is in an unstable state and should be restarted.

    Unfortunately the quick start guide doesn't mention what to do when things go wrong. What do I need to do here? Is ModelsBuilder conflicting with things, and do I need to turn it off? If so, how? Or am I on the wrong track entirely?

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Dec 07, 2022 @ 09:57
    Nik
    100

    Hi Chris,

    Taking a guess here, is your Render Controller called SearchController : RenderController ? If so, if your doctype is actually Search Page the controller needs to be called SearchPageController : RenderController else the automatic route hijacking behaviour of Umbraco won't kick in.

    Nik

  • Chris Mahoney 235 posts 447 karma points
    Dec 07, 2022 @ 19:18
    Chris Mahoney
    0

    Aha! Thank you very much. It's always something simple and the trick is just to figure out what that "something" is.

    Thanks again :)

Please Sign in or register to post replies

Write your reply to:

Draft