Skip to content

Magento2.4.6: How to apply category filter on catalog search results product collection?

I want to exclude specific category products from the search results collection, for example, if a customer is not logged in I don’t want to show products in search results whose category id is 35.
Any idea?
enter image description here