Exclude scopes to search in - BloomReach Experience - Open Source CMS

This article covers a Hippo CMS version 10. There's an updated version available that covers our most recent release.

12-05-2015

Exclude scopes to search in

Next to including scopes to search in, you can also exclude scopes to search in. For example, if you want to search in your current channel only, but exclude news and agenda folder, you can achieve this through:

HippoSolrClient solrClient =
      HstServices.getComponentManager().getComponent(
                    HippoSolrClient.class.getName(), "org.hippoecm.hst.solr");
HippoQuery hippoQuery = solrClient.createQuery(query);
String scope = request.getRequestContext().getResolvedMount().
                               getMount().getCanonicalContentPath();
hippoQuery.setScopes(scope);
hippoQuery.setExcludedScopes(scope+"/news", scope+"/agenda");
Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?