November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi, Johan
Have you checked that your initialization of Find returns proper highlighting syntax as specified in the documentation?https://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/9/DotNET-Client-API/Searching/Highlightning/
I don't think there should be an issue with having a mix of html content for the indexed entries but perhaps you have not set the custom css styles for highlighting the content in your project's stylesheets?
Hi,
Vi sågs bestämt på en lunch bredvid Consid för inte länge sen ;)
I've setup highlighting and I'm creating my projection as follows but the problem is the resulting <mark> sections seem to not heed the structure of the HTML tags:
var highlightSpec = new HighlightSpec()
{
NumberOfFragments = 1,
FragmentSize = 200,
PreTag = "<mark>",
PostTag = "</mark>",
};
var projection = search.Select(x => new
{
ContentLink = x.ContentLink,
HighlightedTitle = x.SearchTitle().AsHighlighted(highlightSpec),
HighlightedContent = x.MyHtmlProp.AsHighlighted(highlightSpec)
})
.StaticallyCacheFor(TimeSpan.FromMinutes(1))
.GetResult();
The result when the marked phrase is overlapping HTML is for example:
<ul>
<li>Lorem ipsum <mark>dolor</li>
<li>sit amet</mark> consectetur adipiscing elit</li>
</ul>
Det stämmer ju bra :)
Check if the Pre/PostTagForAllHighlights works out better for you:
public UnifiedSearchResults Search(string query)
{
var querySearch = _client.UnifiedSearchFor(query);
var hitSpecification = new HitSpecification
{
PreTagForAllHighlights = "<em class='highlight--text'>",
PostTagForAllHighlights = "</em>",
HighlightTitle = true,
HighlightExcerpt = true
};
var currentCulture = ContentLanguage.PreferredCulture;
return querySearch.OverrideCurrentLanguage(currentCulture.Name).Track().ApplyBestBets().GetResult(hitSpecification);
}
Thanks but we're using typed search and not unified search. I've since solved it by just extracting the highlight fragments and delegating the actual highlighting to the client instead.
Hi,
Is highlighting with AsHighlighted not supported on indexed content that contains HTML tags? I am getting a search hit on the content document, but the value returned from AsHighlighted is empty. If I index the field without HTML tags, the highlighting works. (I am not using unified search, I'm using typed search.)
Update: some times I get a highlighted result back, but the marking tags interfere with the HTML tags.