Search only in the current channel (current scope)

By default, if you do not specify a scope to search in, the search is done over all scopes : Thus all channels, all external sources, etc.

If in your java code, you want to specify to only search below your current channel, you can achieve this as follows:

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);
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?

    We rely on cookies

    to optimize our communication and to enhance your customer experience. By clicking on the Accept and Close button, you agree to the collection of cookies. You can also adjust your preferences by clicking on Manage Preferences. For more information please see our Privacy policy.

    Manage cookies
    Accept & close

    Cookies preferences

    Accept & close
    Back