Make Page Designer Pages Searchable

Page Designer pages and components are content assets, but they're not assigned to folders. To make them searchable, you must extend the ContentSearchModel to remove the folder filter.

Add the following line to the setupContentSearch function in the searchHelpers.js file so that searching can find content assets that are not in folders:


The modified setupContentSearch function be similar to this:

function setupContentSearch(params) {
    var ContentSearchModel = require('dw/content/ContentSearchModel');
    var ContentSearch = require('*/cartridge/models/search/contentSearch');
    var apiContentSearchModel = new ContentSearchModel();

    var contentSearchResult = apiContentSearchModel.getContent();
    var count = Number(apiContentSearchModel.getCount());
    var contentSearch = new ContentSearch(contentSearchResult, count, params.q, params.startingPage, null);

    return contentSearch;