You should always use GetContentResult() for ContentData. GetResult() doesn't work in "old" Find either. If you remove PageCategory from the index, you will get an error on another property instead, usually PageName.
That is true Johan, this has started to work after I fixed the assambly-errors in the other thread so it is not so urgent now.
A question, is it hard to make a custom object (I index a lot of stuff that are not inside EPiServer) to inherit from IContent? For example this class
using EPiServer.Find;
namespace ActiveSolution.Customer.Entities.EPiServerFind
{
public class ContactPersonToIndex
{
[Id]
public string Id { get; set; }
public string KomplettTitel { get; set; }
public string HeadTitle { get; set; }
public string FreeTextTitle { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public string ImagePath { get; set; }
public string StreetAddress { get; set; }
public string PostalCode { get; set; }
public string Ort { get; set; }
public string Corporation { get; set; }
}
}
I don't see the reason why you want to do that, unless you want to expose the objects in the UI and have a content provider. By having a conten provider you can use the cms apis to query data, like GetChildren() and so on.
That is true Johan, the only reason I can think of is that I would be able to use GetContentResult in Find with it built in functions for cache and so and that is why I have not done it yet.
I am using Unified Search for my main content and GetResult for my other objects and it works now when I fixed the assambly problem.
Thanks
When I try to do a simple search on a pagetype I get this error:
{"Property 'PageCategory' does not exist, can only assign values to existing properties"}
I thought that property was built in and not able to remove and I do not know that I have done anything to remove it.
Anyone else got this?
By the way, this works:
var queryContentResultFromPage = SearchClient.Instance.Search<StandardPage>().For("lernia").GetContentResult();
and this does not work:
var queryResultFromPage = SearchClient.Instance.Search<StandardPage>().For("lernia").GetResult();