Gravatar for

Question by abhinav, Dec 5, 2018 5:21 AM

exclude item without presentation details from search result

We would like to indexed all items regardless whether they have presentation details or not but on search result we want items with presentation details only. We can't follow this link because it's excluding items from indexed too.

Am following this link but not getting that rule.

Gravatar for

Comment by Jean-François L'Heureux, Dec 5, 2018 10:22 AM

Which edition of Coveo for Sitecore do you have? Pro Cloud or Enterprise Cloud?

Gravatar for

Comment by Jean-François L'Heureux, Dec 5, 2018 2:58 PM

Can I ask why do you want items that do not have a layout to be indexed?

1 Reply
Gravatar for

Answer by Jean-François L'Heureux, Dec 5, 2018 2:57 PM

Pro Cloud edition of Coveo for Sitecore does not have the filtering/booting rule editor feature. You should instead add the filtering rule programmatically.

With Coveo for Sitecore Hive UI framework:

With Coveo for Sitecore Legacy UI framework:

To only include indexed items that have a layout (presentation details) in the search results, you have to add a filter like this: `@haslayout=="1"`.

The field is `haslayout`. It might be translated to a Coveo field name like `fhaslayoutYYYYY`. For that, you need to use the `ToCoveoFieldName` server-side method (Legacy UI) or `CoveoForSitecore.Context.fields.toCoveo` JavaScript function (Hive framework).

The field expression operator is `==` for exact match.

The value of the field expression is `"1"` as a string. This is the indexed value for a boolean `true`.

Gravatar for

Comment by abhinav, Dec 5, 2018 6:27 PM

shall we use two expression like below

    document.addEventListener('DOMContentLoaded', function() {
        var expressionBuilder = new Coveo.ExpressionBuilder();
        var fieldName = CoveoForSitecore.Context.fields.toCoveo('@@_id');
var layout = CoveoForSitecore.Context.fields.toCoveo('@haslayout');
        var homePageID = 'A5551D45FCE245718E4066F82E67D646';
        var searchPageID = 'A03A727F95E04CF7BB31D196F9756BEE';
        var contentPathValues = [homePageID, searchPageID];
        expressionBuilder.addFieldNotEqualExpression(fieldName, contentPathValues);
expressionBuilder.addFieldExpression(layout, '==', '1');
        document.getElementById('JSFilterExpression').dataset.scAdvancedFilter =;
Ask a question