Gravatar for slangevin@coveo.com

Question by Simon, Apr 23, 2014 3:23 PM

Options for Sitecore instances using MVC?

Coveo for Sitecore's search interface components are ascx controls. Is there an interface component which could work with an MVC-enabled Sitecore instance?

2 Replies
Gravatar for amorin@coveo.com

Answer by Antoine Morin, Apr 23, 2014 3:41 PM

Support for MVC was introduced in our May release of Coveo for Sitecore. In this release, we provide views and models for our standard components, i.e. the Search Interface, Sort and Facet components, along with interfaces for the models (IFacetModel, ISortModel, etc.)

The page List of Available Components on developers.coveo.com provides a bit more information about this subject.

Gravatar for dan@getfishtank.ca

Answer by Dan Cruickshank, May 8, 2014 10:58 AM

I've done a lot of MVC work with the pre-May release of Coveo. One thing to keep in mind - because the interface is JS-based you can still accomplish a lot with MVC. My approach has been to use the controller to capture the values Coveo will be looking for:

  • Culture
  • Language
  • Source
  • FieldNames in Coveo
  • Path
  • TemplateIds
  • etc

… then pass them through to the view for the JS UI to consume. Coveo provides a lot of the methods you need like:

viewModel.CultureName = SitecoreRestUtil.GetCurrentCulture();

viewModel.IndexSourceName = SitecoreRestUtil.RetrieveIndexSourceName();

SitecoreUtilities.ToCoveoFieldName(sitecoreField, usePrefix);

With some effort you can also embed custom MVC renderings alongside Coveo's default Layout/Sublayout.

Ask a question