EPiServer.Find 10.0.0.3291EPiServer 18.104.22.168
I have a very simple page type. This is the code that uses EPiFind:
var result = SearchClient.Instance.Search().GetResult();
That code gives me the following exception:
JsonSerializationException was unhandled by user code
An exception of type 'Newtonsoft.Json.JsonSerializationException' occurred in Newtonsoft.Json.dll but was not handled in user code
Additional informtaion: Error setting value to 'Category' on 'MyPageType'
Inner exception: "Property 'PageCategory' does not exist, can only assign values to existing properties"
Everything works fine when if I replace GetResult() with GetPagesResult()
Should I always use GetResult() for custom objects, and GetPagesResult() for episerver page objects, or am I missing something?
from an old post, hope that will answer.
When searching with the general .NET API search queries are usually executed using a method named GetResult which returns, among other things, matching objects or projections from matching objects by de-serializing them from JSON. However, when executing a query for EPiServer pages and files stored in VPP folder we often want the returned objects to be the EPiServer objects, such as PageData objects, returned from the EPiServer APIs and not objects deserialized from the index.
GetContentResult and GetFilesResult both return instances of a type which contain the matching objects, such as matching content objects. These types are ContentResult and FilesResult. This is accomplished by fetching the matching objects IDs from the search engine and then fetching the actual objects from the CMS' API. GetPagesResult return instances of a type which contain the matching objects, such as matching PageData objects. Types is PagesResult. GetResult: For scenarios where we don't want the whole IContent or UnifiedFile objects but rather a subset of their content, perhaps with highlighting we can instead use the regular GetResult method.