code: public static List<String> getSearchRootsForScope(
          CmsGallerySearchScope scope,
          String siteParam,
          String subSiteParam) {
  
          List<String> result = new ArrayList<String>();
          if (scope == CmsGallerySearchScope.everything) {
              result.add("/");
              return result;
          }
          if (scope.isIncludeSite()) {
              result.add(siteParam);
          }
          if (scope.isIncludeSubSite()) {
              if (subSiteParam == null) {
                  result.add(siteParam);
              } else {
                  result.add(CmsStringUtil.joinPaths(siteParam, subSiteParam));
              }
          }
          if (scope.isIncludeShared()) {
              String sharedFolder = OpenCms.getSiteManager().getSharedFolder();
              if (sharedFolder != null) {
                  result.add(sharedFolder);
              }
              result.add(CmsSiteManagerImpl.PATH_SYSTEM_SHARED_FOLDER);
          }
          return result;
      }
docs: Gets the search roots to use for the given site/subsite parameters.<p>
  
  @param scope the search scope
  @param siteParam the current site
  @param subSiteParam the current subsite
  
  @return the list of search roots for that option