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?
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.
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?
Hi Chris,
Taking a guess here, is your Render Controller called
SearchController : RenderController
? If so, if your doctype is actuallySearch Page
the controller needs to be calledSearchPageController : RenderController
else the automatic route hijacking behaviour of Umbraco won't kick in.Nik
Aha! Thank you very much. It's always something simple and the trick is just to figure out what that "something" is.
Thanks again :)
is working on a reply...