November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Can you tried GetContentResult instead?
It will return PageData (or rahter IContent-data) to you.
try using SearchClient.Instance instead of CreateFromConfig, and use GetPagesResult instead of GetResult.
GetPagesResult() doesnt exist in epifind 1.0.0.343 (using epi 6r2). Allthough the wiki says it should..
http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-Find/8/Integration/EPiServer-CMS-6-R2/Querying-examples-CMS-6-R2/
Anyone with similiar problem?
Yes using statement for episerver.find.cms solved it thx :) Intelisence and EpiFind are not best palls :)
What if I want to find content that is NOT of type IContentData? GetResult() crashes with the above-mentioned error, while GetContentResult(), which does not crash, can only be used for IContentData. Any solutions? This seems like a rather important bug, as it severely limits the ways we can use the Find index.
Model? Query? I'm actually not sure what you are asking about... Latest version of EPiServer CMS + EPiServer Find.
var result = _client.Search
.GetResult();
As long as I was only searching my index for page types, the above-mentioned work-around of using GetContentResult() workied fine.
Model as in "show us the class code for MySpecialObjectThatIsNotAndShouldNotBeOfTypeIContentData" :)
The class I'm indexing here:
public class CourseWithMetaData
{
[Id]
public Guid CourseGuid { get; set; }
public CoursePage CoursePage { get; set; }
public CourseContainer MetaData { get; set; }
public string SearchTitle { get; set; }
}
Indexing is done with:
ContentIndexer.Instance.Conventions.ForInstancesOf
.ShouldIndex(new EPiServerFindIndexing().CoursePageIndexingWithMetaData);
Which is calling this:
public class EPiServerFindIndexing
{
private readonly ICourseDelegate _courseDelegate = ServiceLocator.Current.GetInstance
public bool CoursePageIndexingWithMetaData(CoursePage coursePage)
{
var metaData = GetMetaDataAsync(coursePage);
var courseWithMetaData = new CourseWithMetaData
{
CourseGuid = new Guid(coursePage.KursId),
CoursePage = coursePage,
MetaData = metaData,
SearchTitle = coursePage.Name
};
SearchClient.Instance.Index(courseWithMetaData);
return false;
}
private CourseContainer GetMetaDataAsync(CoursePage coursePage)
{
return _courseDelegate.GetAsync(new Guid(coursePage.KursId)).Result;
}
}
This works fine, and everything shows up in the index as expected, with all relevant data etc.
The search code is this:
public List
{
var result = _client.Search
.Select(x => x.CoursePage)
.GetResult();
return result.ToList();
}
This crashes with the following error:
Server Error in '/' Application. Property 'PagePendingPublish' does not exist, can only assign values to existing properties Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: EPiServer.Core.EPiServerException: Property 'PagePendingPublish' does not exist, can only assign values to existing properties
Source Error:
Line 65: public List |
Source File: c:\Workspaces\Tekna.no\Source\Main\Delegate\Implementations\SearchDelegate.cs Line: 67
Stack Trace:
[EPiServerException: Property 'PagePendingPublish' does not exist, can only assign values to existing properties] EPiServer.Core.ContentData.SetValue(String index, Object value) +221 EPiServer.Core.PageData.set_IsPendingPublish(Boolean value) +66 Newtonsoft.Json.Serialization.DynamicValueProvider.SetValue(Object target, Object value) +410 [JsonSerializationException: Error setting value to 'IsPendingPublish' on 'CGI.Delegate.Models.Pages.CoursePage'.] Newtonsoft.Json.Serialization.DynamicValueProvider.SetValue(Object target, Object value) +596 Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) +454 Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) +2106 Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) +441 Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) +188 Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) +790 Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) +792 EPiServer.Find.ProjectionHelper.DeserializeObject(JToken root) +422 [ProjectionException: An exception of type JsonSerializationException was thrown while deserializing object.] EPiServer.Find.ProjectionHelper.DeserializeObject(JToken root) +907 EPiServer.Find.ProjectionHelper.AddPartialFields(SearchRequestBody requestBody, SearchHit`1 searchHit, Dictionary`2 args) +1255 EPiServer.Find.ProjectionHelper.GetFieldValues(SearchRequestBody requestBody, SearchHit`1 searchHit) +1260 EPiServer.Find.ProjectionHelper.GetMappedSearchResultItem(SearchRequestBody requestBody, SearchHit`1 searchHit) +248 EPiServer.Find.ProjectionHelper.GetMappedResult(SearchRequestBody requestBody, SearchResults`1 jsonResult) +642 EPiServer.Find.SearchExtensions.GetProjectedResult(ISearch`1 search, SearchContext context) +591 EPiServer.Find.SearchExtensions.GetResult(ISearch`1 search) +496 CGI.Delegate.Implementations.SearchDelegate.GetAllCourses() in c:\Workspaces\Tekna.no\Source\Main\Delegate\Implementations\SearchDelegate.cs:67 CGI.Tekna.Controllers.CourseListPageController.Index(CourseListPage currentPage) in c:\Workspaces\Tekna.no\Source\Main\Tekna\Controllers\CourseListPageController.cs:19 lambda_method(Closure , ControllerBase , Object[] ) +127 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +242 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39 System.Web.Mvc.Async.AsyncControllerActionInvoker. |
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237
You need to (re)set the CoursePage property using a call to EPiServer's ContentRepository in order to get everything populated correctly, Find module can't do this on it's own (I'm fairly certain).
This is what GetContentResult() does with it's internal GetResult() call result set, it does a ContentRepository.GetContents([] id, id, id) on the found contents' references and therefore always has live data from regular cache or db.
Superb! This works:
public List
{
var result = _client.Search
.Select(x => _contentRepository.Get
.GetResult();
return result.ToList();
}
Thanks a lot!
Got the same error in 7,5.
Using GetPagesResult() instead of GetResult() solved the problem for me.
The error still exist in EPiServer Find 12
In my case i tried to move the SearchResult construction out of the query, IE
.Select(x => new SearchResult { Url = resolver.GetUrl(x.ContentLink), Title = string.IsNullOrEmpty(x.Title) ? x.Name : x.Title, Section = x.SearchSection(), Excerpt = x.MainBody == null ? "" : x.MainBody.AsHighlighted(new HighlightSpec { NumberOfFragments = 3, Concatenation = fragments => fragments.Concatenate(" ... "), FragmentSize = 150 }) })
To
.Select(x => new SearchResult(x)) // where the constructor of SearchResult looks like this public SearchResult(ArticlePage articlePage) { var resolver = ServiceLocator.Current.GetInstance<UrlResolver>(); Url = resolver.GetUrl(articlePage.ContentLink); Title = string.IsNullOrEmpty(articlePage.Title) ? articlePage.Name : articlePage.Title; Section = articlePage.SearchSection(); Excerpt = articlePage.MainBody == null ? "" : articlePage.MainBody.AsHighlighted(new HighlightSpec { NumberOfFragments = 3, Concatenation = fragments => fragments.Concatenate(" ... "), FragmentSize = 150 }); }
Silly me to think that would work
It appears this limitation is somehow documented as well
The Select method's primary limitation is that it does not support projecting from complex types, except for enumerables of non-complex types.
Hi all,
I have installed EPiServer Find version 1.0.0.343 to an CMS 6 R2 site. Indexing, browsing the index etc are working as it should, but when I try to do a search trough the API it fails. Have I missed something basic?
Code:
Gives error:
Source File: c:\EPiServer\Sites\Customer\src\Project\Templates\Pages\Search.aspx.cs Line: 30
Stack Trace:
I can see in Fiddler that the result from es-api01.episerver.com has a value for PageName$$string=Tittel på side
What am I missing here?