code: private CmsGallerySearchBean search(CmsGallerySearchBean searchObj) throws CmsException {
  
          CmsGallerySearchBean searchObjBean = new CmsGallerySearchBean(searchObj);
          if (searchObj == null) {
              return searchObjBean;
          }
          // store folder filter
          storeFolderFilter(searchObj.getFolders());
  
          // search
          CmsGallerySearchParameters params = prepareSearchParams(searchObj);
          org.opencms.search.galleries.CmsGallerySearch searchBean = new org.opencms.search.galleries.CmsGallerySearch();
          CmsObject searchCms = getSearchCms(searchObj);
          searchBean.init(searchCms);
  
          CmsGallerySearchResultList searchResults = OpenCms.getSearchManager().getIndexSolr(
              "Solr Offline").gallerySearch(searchCms, params);
          searchResults.calculatePages(params.getResultPage(), params.getMatchesPerPage());
  
          // set only the result dependent search params for this search
          // the user dependent params(galleries, types etc.) remain unchanged
          searchObjBean.setSortOrder(params.getSortOrder().name());
          searchObjBean.setScope(params.getScope());
          searchObjBean.setResultCount(searchResults.getHitCount());
          searchObjBean.setPage(params.getResultPage());
          searchObjBean.setLastPage(params.getResultPage());
          searchObjBean.setResults(buildSearchResultList(searchResults, null));
          if (searchObj.getGalleryMode().equals(GalleryMode.ade)) {
              if (searchObjBean.getResultCount() > 0) {
                  CmsADESessionCache cache = CmsADESessionCache.getCache(getRequest(), getCmsObject());
                  cache.setLastPageEditorGallerySearch(searchObj);
              }
          }
          updateNoUploadReason(searchCms, searchObjBean);
          return searchObjBean;
      }
docs: Returns the gallery search object containing the results for the current parameter.<p>
  
  @param searchObj the current search object
  
  @return the search result
  
  @throws CmsException if the search fails