Interface I_CmsSearchIndex

All Superinterfaces:
I_CmsConfigurationParameterHandler, Serializable
All Known Implementing Classes:
A_CmsSearchIndex, CmsSearchIndex, CmsSolrIndex

Interface for search indizes that should be handled by the CmsSearchManager.
  • Field Details

  • Method Details

    • getContentIfUnchanged

      The method should return the extraction result of a content from the index, if sure the content has not changed since last indexing. This will prevent re-extraction of the content. Preventing re-extraction saves time while indexing, e.g., if only meta-data of a content has changed. If no up-to-date content can be provided from the index, return null.
      Parameters:
      resource - the resource the content should be provided for.
      Returns:
      the up-to-date extraction result as gained from the index - if possible, or null, if no up-to-date extraction result can be obtained from the index.
    • getFieldConfigurationName

      Returns the name of the field configuration used for this index.

      Returns:
      the name of the field configuration used for this index
    • getLocaleForResource

      Locale getLocaleForResource(CmsObject cms, CmsResource resource, List<Locale> availableLocales)
      Returns the language locale for the given resource in this index.

      Parameters:
      cms - the current OpenCms user context
      resource - the resource to check
      availableLocales - a list of locales supported by the resource
      Returns:
      the language locale for the given resource in this index
    • getSourceNames

      Returns all configured sources names of this search index.

      Returns:
      a list with all configured sources names of this search index
    • isExtractingContent

      Returns true if full text is extracted by this index.

      Full text content extraction can be turned off in the index search configuration parameters in opencms-search.xml. Not extraction the full text information will highly improve performance.

      Returns:
      true if full text is extracted by this index
    • isLanguageDetection

      Returns the languageDetection.

      Returns:
      the languageDetection
    • isUpdatedIncremental

      Returns true in case this index is updated incremental.

      An index is updated incremental if the index rebuild mode as defined by getRebuildMode() is either set to "auto" or "offline". Moreover, at least one update must have been written to the index already.

      Returns:
      true in case this index is updated incremental
    • removeSourceName

      void removeSourceName(String sourceName)
      Removes an index source from this search index.

      Parameters:
      sourceName - the index source name to remove
    • setLocale

      void setLocale(Locale locale)
      Sets the locale to index resources.

      Parameters:
      locale - the locale to index resources
    • addSourceName

      void addSourceName(String sourceName)
      Adds am index source to this search index.

      Parameters:
      sourceName - the index source name to add
    • checkConfiguration

      Checks is this index has been configured correctly.

      In case the check fails, the enabled property is set to false

      Parameters:
      cms - a OpenCms user context to perform the checks with (should have "Administrator" permissions)
      Returns:
      true in case the index is correctly configured and enabled after the check
      See Also:
    • createEmptyDocument

      Creates an empty document that can be used by this search field configuration.

      Parameters:
      resource - the resource to create the document for
      Returns:
      a new and empty document
    • excludeFromIndex

      boolean excludeFromIndex(CmsObject cms, CmsResource resource)
      Checks if the provided resource should be excluded from this search index.

      Parameters:
      cms - the OpenCms context used for building the search index
      resource - the resource to index
      Returns:
      true if the resource should be excluded, false if it should be included in this index
    • getDocumentFactory

      Returns the document type factory used for the given resource in this index, or null in case the resource is not indexed by this index.

      A resource is indexed if the following is all true:

      1. The index contains at last one index source matching the root path of the given resource.
      2. For this matching index source, the document type factory needed by the resource is also configured.
      Parameters:
      res - the resource to check
      Returns:
      he document type factory used for the given resource in this index, or null in case the resource is not indexed by this index
    • getFieldConfiguration

      Returns the search field configuration of this index.

      Returns:
      the search field configuration of this index
    • getIndexWriter

      Returns a new index writer for this index.

      Parameters:
      report - the report to write error messages on
      create - if true a whole new index is created, if false an existing index is updated
      Returns:
      a new instance of IndexWriter
      Throws:
      CmsIndexException - if the index can not be opened
    • getLocale

      Returns the language locale of this index.

      Returns:
      the language locale of this index, for example "en"
    • getName

      Gets the name of this index.

      Returns:
      the name of the index
    • getPath

      Returns the path where this index stores it's data in the "real" file system.

      Returns:
      the path where this index stores it's data in the "real" file system
    • getProject

      Gets the project of this index.

      Returns:
      the project of the index, i.e. "online"
    • getRebuildMode

      Get the rebuild mode of this index.

      Returns:
      the current rebuild mode
    • getSources

      Returns all configured index sources of this search index.

      Returns:
      all configured index sources of this search index
    • initialize

      Initializes the search index.

      Throws:
      CmsSearchException - if the index source association failed or a configuration error occurred
    • isEnabled

      boolean isEnabled()
      Returns true if this index is currently disabled.

      Returns:
      true if this index is currently disabled
    • isInitialized

      boolean isInitialized()
      Returns a flag, indicating if the search index is successfully initialized.
      Returns:
      a flag, indicating if the search index is successfully initialized.
    • onIndexChanged

      void onIndexChanged(boolean force)
      Method called by the search manager if the index has changed. Typically the index searcher is reset when the method is called.
      Parameters:
      force - if false the index might decide itself it it has to act on the change, if true it should act, even if itself cannot detect an index change.
    • setEnabled

      void setEnabled(boolean enabled)
      Can be used to enable / disable this index.

      Parameters:
      enabled - the state of the index to set
    • setFieldConfigurationName

      void setFieldConfigurationName(String fieldConfigurationName)
      Sets the name of the field configuration used for this index.

      Parameters:
      fieldConfigurationName - the name of the field configuration to set
    • setLocaleString

      void setLocaleString(String locale)
      Sets the locale to index resources as a String.

      Parameters:
      locale - the locale to index resources
      See Also:
    • setName

      Sets the logical key/name of this search index.

      Parameters:
      name - the logical key/name of this search index
      Throws:
      CmsIllegalArgumentException - if the given name is null, empty or already taken by another search index
    • setProject

      void setProject(String project)
      Sets the name of the project used to index resources.

      Parameters:
      project - the name of the project used to index resources
    • setRebuildMode

      void setRebuildMode(String rebuildMode)
      Sets the rebuild mode of this search index.

      Parameters:
      rebuildMode - the rebuild mode of this search index {auto|manual}
    • shutDown

      void shutDown()
      Shuts down the search index.

      This will close the local Lucene index searcher instance.