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.
Which edition of Coveo for Sitecore do you have? Pro Cloud or Enterprise Cloud?
Can I ask why do you want items that do not have a layout to be indexed?
Actually we have redirect tool and all redirect items doesn't have presentation details but would needed to be indexed for search so that we could redirect pages to correct pages.
But that redirect item should not be visible on front.
I have also observed that search is working upon only item name but we want to configure on all fields so how we can do that?
That should be a separate question. Please try to limit each post to only one question. It is better for searchability on public search engines. Thanks
Answer by Jean-François L'Heureux · Dec 05, 2018 at 02: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: https://docs.coveo.com/en/991/coveo-for-sitecore-v4/filtering-and-ranking-rules-using-javascript
With Coveo for Sitecore Legacy UI framework: https://docs.coveo.com/en/752/coveo-for-sitecore-v4/using-boosting-or-filtering-rules-on-the-search-component-programmatically-using-the-coveo-for-sitecore-legacy-search-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
.
shall we use two expression like below
<script> 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 = expressionBuilder.build(); }); </script>
No, you do not need that. Do you understand what this code does? Why would you think you need it?
Okay....actually we have to remove Home, Search etc page from search list along with items without presentation details. I have already included Js Query filter into our project. That's why i wanted to confirm that shall we include that too into same cshtml.