Package org.opencms.search
Class CmsIndexingThread
- java.lang.Object
-
- java.lang.Thread
-
- org.opencms.search.CmsIndexingThread
-
- All Implemented Interfaces:
java.lang.Runnable
public class CmsIndexingThread extends java.lang.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 Summary
Constructors Constructor Description CmsIndexingThread(CmsObject cms, CmsResource res, I_CmsSearchIndex index, int count, I_CmsReport report)
Create a new indexing thread.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected I_CmsSearchDocument
createDefaultIndexDocument()
Creates a document for the resource without extracting the content.protected I_CmsSearchDocument
createIndexDocument(CmsObject cms, CmsResource res, I_CmsSearchIndex index, int count, I_CmsReport report)
Creates the search index document.I_CmsSearchDocument
getResult()
Returns the document created by this indexer thread.void
run()
Starts the thread to index a single resource.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Constructor Detail
-
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 contextres
- the resource to indexindex
- the index to update the resource incount
- the report countreport
- the report to write the output to
-
-
Method Detail
-
getResult
public I_CmsSearchDocument 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 interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
- See Also:
Runnable.run()
-
createDefaultIndexDocument
protected I_CmsSearchDocument 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 contextres
- the resource to indexindex
- the index to update the resource incount
- the report countreport
- 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
-
-