code: protected BooleanQuery.Builder appendPathFilter(CmsObject cms, BooleanQuery.Builder filter, List<String> roots) {
  
          // complete the search root
          List<Term> terms = new ArrayList<Term>();
          if ((roots != null) && (roots.size() > 0)) {
              // add the all configured search roots with will request context
              for (int i = 0; i < roots.size(); i++) {
                  String searchRoot = cms.getRequestContext().addSiteRoot(roots.get(i));
                  extendPathFilter(terms, searchRoot);
              }
          } else {
              // use the current site root as the search root
              extendPathFilter(terms, cms.getRequestContext().getSiteRoot());
              // also add the shared folder (v 8.0)
              if (OpenCms.getSiteManager().getSharedFolder() != null) {
                  extendPathFilter(terms, OpenCms.getSiteManager().getSharedFolder());
              }
          }
  
          // add the calculated path filter for the root path
          BooleanQuery.Builder build = new BooleanQuery.Builder();
          terms.forEach(term -> build.add(new TermQuery(term), Occur.SHOULD));
          filter.add(new BooleanClause(build.build(), BooleanClause.Occur.MUST));
          return filter;
      }
docs: Appends the a VFS path filter to the given filter clause that matches all given root paths.<p>
  
  In case the provided List is null or empty, the current request context site root is appended.<p>
  
  The original filter parameter is extended and also provided as return value.<p>
  
  @param cms the current OpenCms search context
  @param filter the filter to extend
  @param roots the VFS root paths that will compose the filter
  
  @return the extended filter clause