November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
What happens if you do like this?
var searchResults = SearchClient.Instance.MultiSearch<EducationEventPage>() .Search<EducationEventPage>(x => x.For("a").InField(y => y.SearchableDescription)) .GetContentResult();
Then i get a build error; It seems like multisearch does not support GetContentResult()
Error103'EPiServer.Find.IMultiSearch<sokjamfor.Models.Pages.EducationEventPage>' does not contain a definition for 'GetContentResult' and no extension method 'GetContentResult' accepting a first argument of type 'EPiServer.Find.IMultiSearch<sokjamfor.Models.Pages.EducationEventPage>' could be found (are you missing a using directive or an assembly reference?)C:\Users\maer0216\documents\visual studio 2012\Projects\sokjamfor\sokjamfor\Services\SearchService.cs1824sokjamfor
Ok. I have not used multi search so mutch so I was not shore if it would work.
In that case I would try to change to return only the id of the content and then do thing with IContentRepository on the returned list before returning it to the page requesting the search.
Meaning moving that part to after getresult.
ok, that might work (if manage to write the code :)). But then we have the next problem. The code that I put as example in this thread is not the complete use case. What I really want to fetch from find is the facets for a specifick property:
var searchResults = SearchClient.Instance.MultiSearch<EducationEventPage>()
.Search<EducationEventPage>(y => y.TermsFacetFor(x => x.SearchableProvider, facet => facet.Size = 200)
.Filter(filterProvider) //Filter each of the categories so that we get only the ones we want
.Take(1));
Is it possible to achivie this without using FIND?
Magnus
Hi all,
I have problem with that getresult() is throwing an exeption when doing a multisearch in EPIServer FIND 9.
Exeption:
-InnerException{"Error setting value to 'IsPendingPublish' on 'sokjamfor.Models.Pages.EducationEventPage'."}System.Exception {Newtonsoft.Json.JsonSerializationException}
Code:
var searchResults = SearchClient.Instance.MultiSearch()(x => x.For("a").InField(y => y.SearchableDescription))
.Search
.GetResult();
public class EducationEventPage : SearchablePageData
{
public virtual String Identifier { get; set; }
public virtual String Education { get; set; }
public virtual ContentReference EducationRef { get; set; }
public virtual String Provider { get; set; }
....
}
public class SearchablePageData : PageData
{
...
public virtual String SearchableDistance { get; set; }
public virtual String SearchableDescription { get; set; }
...
}
I have tested to do a get() to retrieve the content from the cms as work around suggested in this thread:
http://world.episerver.com/Modules/Forum/Pages/thread.aspx?id=85490
Code:
var searchResults = SearchClient.Instance.MultiSearch()(x => x.For("a").InField(y => y.SearchableDescription)(((IContent)y).ContentLink)))
.Search
.Select(y => contentRepository.Get
.GetResult();
But i can't seem to get it to compile
Error103Cannot implicitly convert type 'EPiServer.Find.ISearch' to 'EPiServer.Find.ITypeSearch'. An explicit conversion exists (are you missing a cast?)C:\Users\maer0216\documents\visual studio 2012\Projects\sokjamfor\sokjamfor\Services\SearchService.cs18322sokjamfor
Any help in the matter is highly appreciated!
Magnus