mercredi 6 juillet 2016

Sitecore.FakeDB and Sitecore Content Search with facets

Following example from section "Refining search results by tagging based facets" from Sitecore Cookbook for Developers. However, i'm using Sitecore.FakeDB to write unit tests against it. I get this error when trying to Getresults()

There is no method 'FacetOn' on type "Sitecore.ContentSearch.Linq.QueryableExtensions' that matches the specified arguments.

Here is the code

SearchResults<ArticleSrch> results = null;
       var query = searchContext.GetQueryable<ArticleSrch>()
                   .Where<ArticleSrch>(i =>(i.TemplateName!=null && i.TemplateName.ToString().Equals("Base Article")))
                   ;
       query = query.FacetOn(facet => facet.Tags); 
       results = query.GetResults();
       return results;

Can anyone assist?

Aucun commentaire:

Enregistrer un commentaire