I have the following block in my solution and my Find index:
// Attributes ommitted for clarity
public class FaqItemBlock : BlockData
{
public virtual string Question { get; set; }
public virtual XhtmlString Answer { get; set; }
public virtual ContentArea BottomContent { get; set; }
}
I want to search for it (by free text), and get back all content, including highlights in the Question and Answer properties. I use GetContentResult for that purpose:
var contentQuery = _searchClient.Search<FaqItemBlock>().For(query).WithHighlight(x => x.Question);
var contentResult = contentQuery.GetContentResult();
Now I run into problems.
1. There is a hit, but no highlight. Am I using WithHighlight wrong?
2. How do I get highlights for both Question and Answer? Can I chain WithHighlight() to include highlights for multiple properties?
By the way, I have tried to achieve the same thing using a projection query and GetResult, but I need the content to display on the result page, e.g. content area, xhtml strings, etc... So GetContentResult seemed like a better fit.