Class CmsSearchIndexSource

java.lang.Object
org.opencms.search.CmsSearchIndexSource
All Implemented Interfaces:
Serializable, Comparable<CmsSearchIndexSource>

A search index source is a description of a list of Cms resources to be indexed.

Since:
6.0.0
See Also:
  • Constructor Details

  • Method Details

    • addConfigurationParameter

      public void addConfigurationParameter(String key, String value)
      Adds a parameter.

      Parameters:
      key - the key/name of the parameter
      value - the value of the parameter
    • addDocumentType

      public void addDocumentType(String key)
      Adds the name of a document type.

      Parameters:
      key - the name of a document type to add
    • addResourceName

      public void addResourceName(String resourceName)
      Adds the path of a Cms resource.

      Parameters:
      resourceName - the path of a Cms resource
    • compareTo

      public int compareTo(CmsSearchIndexSource obj)
      Returns 0 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 interface Comparable<CmsSearchIndexSource>
      Parameters:
      obj - another index source
      Returns:
      0 if the given object is an index source with the same name
      See Also:
    • equals

      public boolean equals(Object obj)
      Two index sources are considered equal if their names as returned by getName() is equal.

      Note that the name of an index source has to be unique within OpenCms.

      Overrides:
      equals in class Object
      See Also:
    • 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

      public String getName()
      Returns the logical key/name of this search index source.

      Returns:
      the logical key/name of this search index source
    • getParam

      public String getParam(String key)
      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

      public int hashCode()
      Overriden to be consistents with overridden method equals(Object).
      Overrides:
      hashCode in class Object
      See Also:
    • init

      public void init()
      Initialization for search index sources.
    • isContaining

      public boolean isContaining(String rootPath)
      Returns true 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

      public boolean isIndexing(String rootPath, String documentTypeKey)
      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.

      Parameters:
      rootPath - the resource root path to check
      documentTypeKey - 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

      public boolean removeDocumentType(String key)
      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

      public void setDocumentTypes(List<String> documentTypes)
      Sets the list of document type names (Strings) to be indexed.

      Parameters:
      documentTypes - the list of document type names (Strings) to be indexed
    • setIndexerClassName

      public void setIndexerClassName(String indexerClassName) throws CmsIllegalArgumentException
      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

      public void setName(String name) throws CmsIllegalArgumentException
      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

      public void setParams(Map<String,String> params)
      Sets the map of optional key/value parameters.

      Parameters:
      params - the map of optional key/value parameters
    • setResourcesNames

      public void setResourcesNames(List<String> resources)
      Sets the list of Cms resources to be indexed.

      Parameters:
      resources - the list of Cms resources (Strings) to be indexed