Try our conversational search powered by Generative AI!

Limit properties included in Excerpt returned from UnifiedSearchFor


Is it possible to specify which properties that are included in the excerpt returned from UnifiedSearchFor?

Btw UnifiedSearchFor yields 0 results when searching at, no docs available?

Feb 18, 2013 9:55

The cobbler's children go unshod

Feb 18, 2013 11:54

Now to your second question:

The Excerpt by default will be either fieldvalues (from SearchSummary, SearchText, SearchAttachment) or highlighted fields (as the above) depending on the HitSpecification.HighlightExcerpt value passed to GetResult. So if you want to change the default you need to change either:

// for field excerpts

                 .CustomizeDefaultProjection(p =>

                     p.ProjectExcerptUsing<ISearchContent>(spec =>
                             x => x.SearchTitle + " " + ..maybe another field value)

// for highlights

                .CustomizeDefaultProjection(p =>
p.ProjectHighlightedExcerptUsing<ISearchContent>(spec =>
                            x => x.SearchText.AsHighlighted(
                                new HighlightSpec { FragmentSize = spec.ExcerptLength, NumberOfFragments = 1 }) + " " + ...maybe another highlighted field)

// to compile you currently also need the following extension

public static HitProjectionBuilder ProjectExcerptUsing<T>(this HitProjectionBuilder builder, Func<HitSpecification, Expression<Func<T, string>>> sourceExpression)
            return new HitProjectionBuilder(builder, projection => projection.ExcerptProjection = sourceExpression);

Edited: the excerpt will be either fieldvalues or highlighted values.



Edited, Feb 18, 2013 12:46

> Btw UnifiedSearchFor yields 0 results when searching at, no docs available?


I'm facing this case now. Any ideas what could be wrong and where to look for any hint?

May 29, 2013 21:32
Edited, Nov 25, 2016 13:14
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.