Restricting documentTypes in Search

Hi,
Is there a way to restrict document types in search?

If you mean the dropdown in the search perspective, yes it’s configurable by
‘document.type.exclude’ at /hippo:configuration/hippo:frontend/cms/cms-advanced-search/genericFilters

See Add Document Search to a Project - Bloomreach Experience Manager - The Fast and Flexible Headless CMS

Cheers, Jeroen

Hi Jeroen,

Thank you for your reply. I did try that and it did work for the search perspective but, the requirement is to restrict the content documents that are not linked to a prototype page to be queried by the out of the box search.
I have tried creating a new HstComponent using the Fluent Search API and new search component in order to meet the requirement of adding a constraint to the query but I am still able to view the content documents that are not linked to a prototype page, with a result of …/site/pagenotfound. This is my hstQuery code

        HstQuery hstQuery = HstQueryBuilder.create(scope)
                .ofTypes(BasePageDocument.class)
                .where(constraint(".").notContains("genericcontentpage-onecolumn"))
                .build();

According to the image attached, page1 is a content document that is not linked to a prototype page but still appears in the search query. The requirement is that this should not be displayed in the search query. Page2 on the other hand is a content document that is linked to a prototype page which is required to be displayed.

OK I get your point. It’s going to be hard to restrict the query that way, because the links are present is a whole different location (HST config) that the scope of the query (content).

An approach can be to change the document model, i.e. extend content document type to only use that type in linking with components.

Another approach can be to have the HST not render pagenotfound links but the actual prototype(-based) page URLs. There is a method HstLinkCreator#createAll for that.

HTH
Jeroen