Don't miss out Virtual Happy Hour today (April 26).

Try our conversational search powered by Generative AI!

Limit properties included in Excerpt returned from UnifiedSearchFor

Vote:
 

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

Btw UnifiedSearchFor yields 0 results when searching at find.episerver.com, no docs available?

#65988
Feb 18, 2013 9:55
Vote:
 

http://find.episerver.com/Documentation/unified-search

The cobbler's children go unshod

#65996
Feb 18, 2013 11:54
Vote:
 

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

client.Conventions.UnifiedSearchRegistry
                 .CustomizeDefaultProjection(p =>

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

// for highlights

client.Conventions.UnifiedSearchRegistry
                .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.

 

/Henrik

#66009
Edited, Feb 18, 2013 12:46
Vote:
 

> Btw UnifiedSearchFor yields 0 results when searching at find.episerver.com, no docs available?

 

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

#71814
May 29, 2013 21:32
Vote:
 
#172191
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.