Package org.opencms.search
Class CmsSearchIndexSource
java.lang.Object
org.opencms.search.CmsSearchIndexSource
- All Implemented Interfaces:
Serializable
,Comparable<CmsSearchIndexSource>
public class CmsSearchIndexSource
extends Object
implements Comparable<CmsSearchIndexSource>, Serializable
A search index source is a description of a list of Cms resources
to be indexed.
- Since:
- 6.0.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addConfigurationParameter
(String key, String value) Adds a parameter.void
addDocumentType
(String key) Adds the name of a document type.void
addResourceName
(String resourceName) Adds the path of a Cms resource.int
Returns0
if the given object is an index source with the same name.boolean
Two index sources are considered equal if their names as returned bygetName()
is equal.getDocumentFactory
(String documentTypeKey) Returns the document factory for given key.Returns the list of names (Strings) of the document types to be indexed.Returns the indexer.Returns the class name of the indexer.getName()
Returns the logical key/name of this search index source.Returns the value for a specified parameter key.Returns the map of optional key/value parameters.Returns the list of VFS resources to be indexed.int
hashCode()
Overriden to be consistents with overridden method
.equals(Object)
void
init()
Initialization for search index sources.boolean
isContaining
(String rootPath) Returnstrue
in case the given resource root path is contained in the list of configured resource names of this index source.boolean
isIndexing
(String rootPath, String documentTypeKey) Returnstrue
in case the given resource root path is contained in the list of configured resource names, and the given document type name is contained in the list if configured document type names of this index source.boolean
removeDocumentType
(String key) Removes the name of a document type from the list of configured types of this index source.void
setDocumentTypes
(List<String> documentTypes) Sets the list of document type names (Strings) to be indexed.void
setIndexerClassName
(String indexerClassName) Sets the class name of the indexer.void
Sets the logical key/name of this search index source.void
Sets the map of optional key/value parameters.void
setResourcesNames
(List<String> resources) Sets the list of Cms resources to be indexed.
-
Constructor Details
-
CmsSearchIndexSource
public CmsSearchIndexSource()Creates a new CmsSearchIndexSource.
-
-
Method Details
-
addConfigurationParameter
Adds a parameter.- Parameters:
key
- the key/name of the parametervalue
- the value of the parameter
-
addDocumentType
Adds the name of a document type.- Parameters:
key
- the name of a document type to add
-
addResourceName
Adds the path of a Cms resource.- Parameters:
resourceName
- the path of a Cms resource
-
compareTo
Returns0
if the given object is an index source with the same name.Note that the name of an index source has to be unique within OpenCms.
- Specified by:
compareTo
in interfaceComparable<CmsSearchIndexSource>
- Parameters:
obj
- another index source- Returns:
0
if the given object is an index source with the same name- See Also:
-
equals
Two index sources are considered equal if their names as returned bygetName()
is equal.Note that the name of an index source has to be unique within OpenCms.
-
getDocumentFactory
Returns the document factory for given key.Note that only the keys resulting from the document types for this source set are taken into account.
- Parameters:
documentTypeKey
- the key for the factory to use.- Returns:
- a document factory or null
-
getDocumentTypes
Returns the list of names (Strings) of the document types to be indexed.- Returns:
- the list of names (Strings) of the document types to be indexed
-
getIndexer
Returns the indexer.- Returns:
- the indexer
-
getIndexerClassName
Returns the class name of the indexer.- Returns:
- the class name of the indexer
-
getName
Returns the logical key/name of this search index source.- Returns:
- the logical key/name of this search index source
-
getParam
Returns the value for a specified parameter key.- Parameters:
key
- the parameter key/name- Returns:
- the value for the specified parameter key
-
getParams
Returns the map of optional key/value parameters.- Returns:
- the map of optional key/value parameters
-
getResourcesNames
Returns the list of VFS resources to be indexed.- Returns:
- the list of VFS resources to be indexed
-
hashCode
Overriden to be consistents with overridden method
.equals(Object)
-
init
Initialization for search index sources. -
isContaining
Returnstrue
in case the given resource root path is contained in the list of configured resource names of this index source.- Parameters:
rootPath
- the resource root path to check- Returns:
true
in case the given resource root path is contained in the list of configured resource names of this index source- See Also:
-
isIndexing
Returnstrue
in case the given resource root path is contained in the list of configured resource names, and the given document type name is contained in the list if configured document type names of this index source.- Parameters:
rootPath
- the resource root path to checkdocumentTypeKey
- the document type key for which the presence of a factory name has to be checked- Returns:
true
in case the given resource root path is contained in the list of configured resource names, and the given document type name is contained in the list if configured document type names of this index source- See Also:
-
removeDocumentType
Removes the name of a document type from the list of configured types of this index source.- Parameters:
key
- the name of the document type to remove- Returns:
- true if the given document type name was contained before thus could be removed successfully, false otherwise
-
setDocumentTypes
Sets the list of document type names (Strings) to be indexed.- Parameters:
documentTypes
- the list of document type names (Strings) to be indexed
-
setIndexerClassName
Sets the class name of the indexer.An Exception is thrown to allow GUI-display of wrong input.
- Parameters:
indexerClassName
- the class name of the indexer- Throws:
CmsIllegalArgumentException
- if the given String is not a fully qualified classname (within this Java VM)
-
setName
Sets the logical key/name of this search index source.- Parameters:
name
- the logical key/name of this search index source- Throws:
CmsIllegalArgumentException
- if argument name is null, an empty or whitespace-only Strings or already used for another indexsource's name.
-
setParams
Sets the map of optional key/value parameters.- Parameters:
params
- the map of optional key/value parameters
-
setResourcesNames
Sets the list of Cms resources to be indexed.- Parameters:
resources
- the list of Cms resources (Strings) to be indexed
-