November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
public class FindProduct { [Id] public string IndexId { get; set; } public string Code { get; set; } public int Id { get; set; } public string DisplayName { get; set; } public string Language { get; set; } public string DefaultImageUrl { get; set; } public XhtmlString Description { get; set; } }
public SearchResults<FindProduct> SearchProductsByStyle(ProductBase productBase, bool selfIncluded = false) { var query = SearchClient.Instance.Search<FindProduct>() .Filter(x => x.StyleCode.Exists()) .Filter(x => x.StyleCode.MatchCaseInsensitive(productBase.StyleCode)) .Filter(x => x.Language.Exists()) .Filter(x => x.Language.MatchCaseInsensitive(productBase.Language.Name)); if (!selfIncluded) { query .Filter(x => x.Code.Exists()) .Filter(x => !x.Code.Match(productBase.Code)); } return query.GetResult(); //.StaticallyCacheFor(TimeSpan.FromMinutes(5)) }
For the time being, I have to change my poco object "Description" type to string, and convert xhtmlstring to html encoded string before assign to description.
EPi find seems not working well with complex object :p
XhtmlString is a complex property type, which is usually fetched when using GetContentResult - which fetches the content from the database.
If possible, I would suggest you change your property type to a string.
By the way, I don't think you need all those .Exists filters. The Match/MatchCaseInsensitive will take care of that anyway - even if the value is null.
Hi Per
Thanks for your prompt reply and code review :)
As I said, I had switched to string already. Are there any other speicial complex types not supported by EPi find?
Well, the XhtmlString is a bit special, as it is built up by fragments. Some of these might not be visible to certain users and some might be references to blocks or media data. Because of this the value that resides in the Find index is a simple serialized value, and the common usage would be to either project the value using .Select or to fetch the content using GetContentResult.
As for other types... I suppose you would get the same problem had you added a property of type ContentArea to your poco object
Hi
I am having an issue when calling GetResult from the search query, the XhtmlString element always return null. I have checked data in the Explorer, it's there.