code: public CmsGallerySearchResultList gallerySearch(CmsObject cms, CmsGallerySearchParameters params) {
  
          CmsGallerySearchResultList resultList = new CmsGallerySearchResultList();
  
          try {
              CmsSolrResultList list = search(
                  cms,
                  params.getQuery(cms),
                  false,
                  null,
                  true,
                  CmsResourceFilter.ONLY_VISIBLE_NO_DELETED,
                  MAX_RESULTS_GALLERY); // ignore the maximally searched number of contents.
  
              if (null == list) {
                  return null;
              }
  
              resultList.setHitCount(Long.valueOf(list.getNumFound()).intValue());
              for (CmsSearchResource resource : list) {
                  I_CmsSearchDocument document = resource.getDocument();
                  Locale locale = CmsLocaleManager.getLocale(params.getLocale());
  
                  CmsGallerySearchResult result = new CmsGallerySearchResult(
                      document,
                      cms,
                      (int)document.getScore(),
                      locale);
  
                  resultList.add(result);
              }
          } catch (CmsSearchException e) {
              LOG.error(e.getMessage(), e);
          }
          return resultList;
      }
docs: Performs a search with according to the gallery search parameters.<p>
  
  @param cms the cms context
  @param params the search parameters
  
  @return the search result