AI OnAI Off
Hi Gustav,
We are looking into that right now. We have made some changes in that area but that was quite a long time ago. May I inquire from what version you are upgrading?
/Marcus
Ok, great.
It's been a while since our last upgrade, we are upgrading from version 8.10.0.1509.
/Gustav
Sure:
var hitSpecification = new HitSpecification { HighlightExcerpt = true, HighlightTitle = false, PreTagForAllHighlights = "<b>", PostTagForAllHighlights = "</b>", ExcerptLength = 200 }; if (!string.IsNullOrWhiteSpace(query)) { var searchQuery = SearchClient.Instance.UnifiedSearchFor(query, Language.Swedish) .UsingSynonyms() .WithAndAsDefaultOperator() .BoostMatching(h => h.MatchType(typeof(QuickAnswerPage)) | h.MatchType(typeof(GuidePage)) | h.MatchType(typeof(ServicePage)), 2) //.ApplyBestBets() .Skip((page - 1)*PageSize) .Take(PageSize); if (type != FilterOptions.All) { searchQuery = searchQuery.FilterHits( h => h.SearchTypeName.Match(GetTypeForFilter(typeFilter).Name) ); } searchQuery = searchQuery.TermsFacetFor(x => x.SearchTypeName) .Track(); searchResult = searchQuery.GetResult(hitSpecification); }
/Gustav
We have indeed identified it as a bug. We resolved the bug and the fix will be included it in the next release. You can use the following workaround in order for you to get your solution working:
1) Add an extension to your indexed object like below:
public static class NativeSearchContentExtensions { public static string Text(this NativeSearchContent content) { return content.SearchText; } }
2) Add Index convention and index your object
client.Conventions.ForInstancesOf<NativeSearchContent>() .IncludeField(x => x.Text()); client.Index(mySearchContent);
2) add your convention
client.Conventions.UnifiedSearchRegistry.Add<NativeSearchContent>() .ProjectHighlightedExcerptUsing<NativeSearchContent>(hitSpec => d => d.Text().AsHighlighted(new HighlightSpec { PreTag = hitSpec.PreTagForAllHighlights, PostTag = hitSpec.PostTagForAllHighlights })) .ProjectTitleFrom<NativeSearchContent>(d => d.SearchText);
3) Search
var hitSpecification = new HitSpecification { HighlightExcerpt = true, HighlightTitle = false, PreTagForAllHighlights = "|start|", PostTagForAllHighlights = "|end|", ExcerptLength = 200 }; client.UnifiedSearchFor("Bacon").GetResult(hitSpecification)
/David
Hi all,
After upgrading to Find 9.2 we have some problems with our highlighting projections. Instead of the correct pre- and post tags "|pre|" and "|post|" are returned.
This is the projection:
The result of this projection is for example "lorem ipsum |pre|myhighlightedword|post| lorem ipsum". It was working before the upgrade.
Bug?