Package org.opencms.search
Class CmsIndexingThread
java.lang.Object
java.lang.Thread
org.opencms.search.CmsIndexingThread
- All Implemented Interfaces:
Runnable
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorDescriptionCmsIndexingThread
(CmsObject cms, CmsResource res, I_CmsSearchIndex index, int count, I_CmsReport report) Create a new indexing thread. -
Method Summary
Modifier and TypeMethodDescriptionprotected I_CmsSearchDocument
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.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 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 contextres
- the resource to indexindex
- the index to update the resource incount
- the report countreport
- 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
Starts the thread to index a single resource. -
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
-