Gravatar for jschjolberg@awareweb.com

Question by jschjolberg, May 8, 2014 5:55 PM

Can you control the excerpt and quickview when using the JavaScript Search Framework?

I'm using the JavaScript Search Framework for the search interface within a Sitecore site. I'm wondering how the excerpt and quickview are created that come back with my results. It looks like what is happening is the Sitecore field name is listed and then the value is displayed following that. When you open the quickview, all of the item fields are listed with their values next to them. Is there a way to set what displays in the excerpt and quickview? I would like to only show certain fields.

1 Reply
Gravatar for vseguin@coveo.com

Answer by Vincent Séguin, May 8, 2014 7:16 PM

Hi,

The excerpt and quick view are depending from what is indexed in the documents body. You probably have the Basic HTML Content processor currently enabled in your Coveo.SearchProvider.config (described here : https://developers.coveo.com/display/SC201405/Indexing+Documents+with+Basic+HTML+Content)

You have two options if you want to change this. You may want to have the real HTML of the document and you can use the HTML Content processor described here : https://developers.coveo.com/display/SC201405/Indexing+Documents+with+HTML+Content+Processor.

Starting from the April build, if you want to simply have some fields in your quick view/excerpt, you can add options to this processor. Here are the available options :

IncludeFieldNames - whether you want the field names or not

IncludeTextFieldsOnly - whether to add only text fields in the HTML content

FieldsToInclude - comma separated list of fields to include.

Finally, you could still code your own processor by derivating from IProcessor.

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, May 9, 2014 2:47 AM

Note that for the Quick View you can also provide your own template for what gets displayed in the popup, instead of using the component that streams the HTML generated at index time.

Gravatar for jschjolberg@awareweb.com

Comment by jschjolberg, May 9, 2014 10:10 AM

Thanks Vincent - as far as the April build goes, is this something that I could easily upgrade to?

Gravatar for jschjolberg@awareweb.com

Comment by jschjolberg, May 9, 2014 10:11 AM

Thanks mlaporte - can you tell me a little more about how to use a custom template for the QuickView?

Gravatar for vseguin@coveo.com

Comment by Vincent Séguin, May 9, 2014 10:17 AM

It depends on which build you're actually, but upgrading is usually a seamless process and entirely documented here : https://developers.coveo.com/display/SC201404/Common+Upgrade+Procedures

Make sure you upgrade both CES and the Sitecore Search Provider.

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, May 15, 2014 4:37 AM

See the doc page here: https://developers.coveo.com/display/JsSearch/QuickView+Component

First you have to locate the template for your quick view. It's usually in the 'result template'. Just grep for CoveoQuickView and you'll find it.

Then, inside the template you'll see a CoveoQuickViewDocument. That's the thing that's displaying the HTML generated at indexation time (in an iframe). Remove it, and put any HTML you want in there instead. It's an Underscore template as are the result templates, so you can inject field values, etc.

Reply if you need more, I out of comment characters :(

Ask a question