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

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?