Package org.opencms.search.galleries
Class CmsGallerySearch
- java.lang.Object
-
- org.opencms.search.galleries.CmsGallerySearch
-
public class CmsGallerySearch extends java.lang.Object
Contains the functions for the gallery search.- Since:
- 8.0.0
-
-
Constructor Summary
Constructors Constructor Description CmsGallerySearch()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getIndex()
Returns the name of the current search index.CmsGallerySearchResultList
getResult(CmsGallerySearchParameters params)
Returns the gallery search result list.CmsSolrIndex
getSearchIndex()
Returns the current gallery search index.void
init(CmsObject cms)
Initializes the bean with the provided OpenCms context object.static CmsGallerySearchResult
searchById(CmsObject cms, CmsUUID structureId, java.util.Locale locale)
Searches by structure id.CmsGallerySearchResult
searchById(CmsUUID id, java.util.Locale locale)
Searches by structure id.CmsGallerySearchResult
searchByPath(java.lang.String path, java.util.Locale locale)
Searches by structure id.static CmsGallerySearchResult
searchByPath(CmsObject cms, java.lang.String rootPath, java.util.Locale locale)
Searches by structure id.void
setIndex(java.lang.String indexName)
Set the name of the index to search.void
setIndexForProject(CmsObject cms)
Sets the index name according to the current project.
-
-
-
Constructor Detail
-
CmsGallerySearch
public CmsGallerySearch()
-
-
Method Detail
-
searchById
public static CmsGallerySearchResult searchById(CmsObject cms, CmsUUID structureId, java.util.Locale locale) throws CmsException
Searches by structure id.- Parameters:
cms
- the OpenCms context to use for the searchstructureId
- the structure id of the document to search forlocale
- the locale for which the search result should be returned- Returns:
- the search result
- Throws:
CmsException
- if something goes wrong
-
searchByPath
public static CmsGallerySearchResult searchByPath(CmsObject cms, java.lang.String rootPath, java.util.Locale locale) throws CmsException
Searches by structure id.- Parameters:
cms
- the OpenCms context to use for the searchrootPath
- the resource root pathlocale
- the locale for which the search result should be returned- Returns:
- the search result
- Throws:
CmsException
- if something goes wrong
-
getIndex
public java.lang.String getIndex()
Returns the name of the current search index.- Returns:
- the name of the current search index
-
getResult
public CmsGallerySearchResultList getResult(CmsGallerySearchParameters params) throws CmsException
Returns the gallery search result list.- Parameters:
params
- the gallery search parameters- Returns:
- the gallery search result list
- Throws:
CmsException
- if the search failed
-
getSearchIndex
public CmsSolrIndex getSearchIndex()
Returns the current gallery search index.- Returns:
- the current gallery search index
-
init
public void init(CmsObject cms)
Initializes the bean with the provided OpenCms context object.- Parameters:
cms
- the OpenCms context to use for the search
-
searchById
public CmsGallerySearchResult searchById(CmsUUID id, java.util.Locale locale) throws CmsException
Searches by structure id.- Parameters:
id
- the structure id of the document to search forlocale
- the locale for which the search result should be returned- Returns:
- the search result
- Throws:
CmsException
- if something goes wrong
-
searchByPath
public CmsGallerySearchResult searchByPath(java.lang.String path, java.util.Locale locale) throws CmsException
Searches by structure id.- Parameters:
path
- the resource pathlocale
- the locale for which the search result should be returned- Returns:
- the search result
- Throws:
CmsException
- if something goes wrong
-
setIndex
public void setIndex(java.lang.String indexName) throws CmsException
Set the name of the index to search.A former search result will be deleted.
- Parameters:
indexName
- the name of the index- Throws:
CmsException
- if the index was not found
-
setIndexForProject
public void setIndexForProject(CmsObject cms) throws CmsException
Sets the index name according to the current project.- Parameters:
cms
- the cms context- Throws:
CmsException
- in case setting the index fails
-
-