Class CmsIndexingThread

java.lang.Object
java.lang.Thread
org.opencms.search.CmsIndexingThread
All Implemented Interfaces:
Runnable

public class CmsIndexingThread extends Thread
Implements the indexing method for a single resource as thread.

The indexing of a single resource is wrapped into a thread in order to prevent the overall indexer from hanging.

Since:
6.0.0
  • Constructor Details

    • CmsIndexingThread

      public CmsIndexingThread(CmsObject cms, CmsResource res, I_CmsSearchIndex index, int count, I_CmsReport report)
      Create a new indexing thread.

      Parameters:
      cms - the current OpenCms user context
      res - the resource to index
      index - the index to update the resource in
      count - the report count
      report - the report to write the output to
  • Method Details

    • getResult

      Returns the document created by this indexer thread.

      In case the resource could not be indexed, null is returned.

      Returns:
      the document created by this indexer thread
    • run

      public void run()
      Starts the thread to index a single resource.

      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
      See Also:
    • createDefaultIndexDocument

      Creates a document for the resource without extracting the content. The aim is to get a content indexed, even if extraction runs into a timeout.
      Returns:
      the document for the resource generated if the content is discarded, i.e., only meta information are indexed.
    • createIndexDocument

      protected I_CmsSearchDocument createIndexDocument(CmsObject cms, CmsResource res, I_CmsSearchIndex index, int count, I_CmsReport report) throws CmsException
      Creates the search index document.

      Parameters:
      cms - the current OpenCms user context
      res - the resource to index
      index - the index to update the resource in
      count - the report count
      report - the report to write the output to
      Returns:
      the created search index document
      Throws:
      CmsException - in case of issues while creating the search index document