Gravatar for

Question by Rik, May 5, 2017 3:08 PM

pdf index issues


We're having some issues with the default Coveo search result on our Sitecore solution.

While the pdf's are indexed (we see them in the admin) and are found (in on the website), we're having 2 issues with them

1. There is no link.
This is probably because the result only shows url's on items that have a layout.
Since the pdf doesn't have one, it doesn't show a link.
Any idea how to add a link to the pdf?

2. The 'clickable url' (in the coveo admin) is wrong.

On the site the pdfs are rendered as:

https://websitename/~/media/Files/Download%20Files/Example.pdf (works)

In the admin we get:

https://websitename/sitecore/shell/~/media/Files/Download Files/Example.pdf (doesn't work)

We use the CES on prem and Coveo for Sitecore 4

In config we have the following relevant (I think) configuration:

<processor type="Coveo.SearchProvider.CoveoInboundFilters.HasLayoutInboundFilter, Coveo.SearchProviderBase">
  <processor type="Coveo.SearchProvider.Processors.HtmlContentInBodyWithRequestsProcessor, Coveo.SearchProviderBase" >
       <StartCommentText>BEGIN NOINDEX</StartCommentText>
       <EndCommentText>END NOINDEX</EndCommentText>

Any help is appreciated.

Gravatar for

Comment by Rik, May 11, 2017 3:32 PM

Anyone any Idea why the url is wrong?

3 Replies
Gravatar for

Answer by François Lachance-Guillemette, May 5, 2017 3:31 PM

For question #1, the way the results are displayed in your page is within a Result Template.

If you take a look at your result template, located in `SearchView.cshtml` in MVC or `CoveoSearch.ascx` for Web Forms, you should see the following tag just about in the middle of the file:

<script class="result-template" type="text/underscore">

This tag contains your template. The file we ship by default displays the title with the following markup:

<div class='coveo-title'>
    {{ if (raw.@(Model.ToCoveoFieldName("HasLayout", false)) === "1" || raw.syssource !== "@Model.IndexSourceName") { }}
        <a class='CoveoResultLink'>{{=title?highlight(title, titleHighlights):clickUri}}</a>
    {{ } else { }}
        <span class='CoveoResultTitle'>{{=title?highlight(title, titleHighlights):''}}</span>
    {{ } }}

See the condition there, it is the one responsible for showing items with a layout.

To customize this file, we recommend to Duplicate the component and apply your changes in the duplicate.

Gravatar for

Comment by Rik, May 8, 2017 6:56 AM

Thank you Francois,

we already played a bit with that layout, so good to know this is the way to go.
But indeed now we see that the url is wrong on the front-end as well and is now triggering a 'layout not found'.

Gravatar for

Answer by Rik, May 17, 2017 2:52 PM

Question #2 is a known issue and was was answered here:

It is in the backlog to be picked up as documented here

Gravatar for

Answer by Rik, May 31, 2017 9:02 AM

@François Lachance-Guillemette

We implemented the fix described in

But that didn't fix it.

While the uri in the Coveo Admin is now the correct one (without the shell, so the fix had effect),

In the search results it is still showing the Sitecore path.

I used the vanilla layout just to be sure:

/en/sitecore/Media Library/Files/Download Files/Spring wire/Spring wire

Coveo admin: Files/Spring wire/Spring wire.pdf


/sitecore/media library/Files/Download Files/Spring wire/Spring wire

Ps the editor seems to accept screenshots, but removes them when submitting

Ask a question