public class CmsSearchManager extends java.lang.Object implements I_CmsScheduledJob, I_CmsEventListener
Modifier and Type | Class and Description |
---|---|
static class |
CmsSearchManager.CmsSearchForceUnlockMode
Enumeration class for force unlock types.
|
protected class |
CmsSearchManager.CmsSearchOfflineHandler
Handles offline index generation.
|
protected class |
CmsSearchManager.CmsSearchOfflineIndexThread
The offline indexer thread runs periodically and indexes all resources added by the event handler.
|
protected class |
CmsSearchManager.CmsSearchOfflineIndexWorkThread
An offline index worker Thread runs each time for every offline index update action.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_EXCERPT_LENGTH
The default value used for generating search result excerpts (1024 chars).
|
static float |
DEFAULT_EXTRACTION_CACHE_MAX_AGE
The default value used for keeping the extraction results in the cache (672 hours = 4 weeks).
|
static int |
DEFAULT_MAX_INDEX_WAITTIME
The default maximal wait time for re-indexing after editing a content.
|
static int |
DEFAULT_MAX_MODIFICATIONS_BEFORE_COMMIT
Default for the maximum number of modifications before a commit in the search index is triggered (500).
|
static int |
DEFAULT_OFFLINE_UPDATE_FREQNENCY
The default update frequency for offline indexes (15000 msec = 15 sec).
|
static int |
DEFAULT_TIMEOUT
The default timeout value used for generating a document for the search index (60000 msec = 1 min).
|
static java.lang.String |
JOB_PARAM_INDEXLIST
Scheduler parameter: Update only a specified list of indexes.
|
static java.lang.String |
JOB_PARAM_WRITELOG
Scheduler parameter: Write the output of the update to the logfile.
|
protected static org.apache.commons.logging.Log |
LOG
The log object for this class.
|
static java.lang.String |
LUCENE_ANALYZER
Prefix for Lucene default analyzers package (
org.apache.lucene.analysis. |
protected CmsObject |
m_adminCms
The administrator OpenCms user context to access OpenCms VFS resources.
|
protected java.util.List<CmsSearchIndex> |
m_offlineIndexes
The list of indexes that are configured for offline index mode.
|
protected CmsSearchManager.CmsSearchOfflineIndexThread |
m_offlineIndexThread
The thread used of offline indexing.
|
EVENT_BEFORE_PUBLISH_PROJECT, EVENT_CLEAR_CACHES, EVENT_CLEAR_OFFLINE_CACHES, EVENT_CLEAR_ONLINE_CACHES, EVENT_CLEAR_PRINCIPAL_CACHES, EVENT_FLEX_CACHE_CLEAR, EVENT_FLEX_PURGE_JSP_REPOSITORY, EVENT_FULLSTATIC_EXPORT, EVENT_GROUP_MODIFIED, EVENT_LOGIN_USER, EVENT_OU_MODIFIED, EVENT_PROJECT_MODIFIED, EVENT_PROPERTY_DEFINITION_CREATED, EVENT_PROPERTY_DEFINITION_MODIFIED, EVENT_PROPERTY_MODIFIED, EVENT_PUBLISH_PROJECT, EVENT_REBUILD_SEARCHINDEXES, EVENT_RESOURCE_AND_PROPERTIES_MODIFIED, EVENT_RESOURCE_COPIED, EVENT_RESOURCE_CREATED, EVENT_RESOURCE_DELETED, EVENT_RESOURCE_MODIFIED, EVENT_RESOURCE_MOVED, EVENT_RESOURCES_AND_PROPERTIES_MODIFIED, EVENT_RESOURCES_MODIFIED, EVENT_SITEMAP_CHANGED, EVENT_UPDATE_EXPORTS, EVENT_USER_MODIFIED, KEY_CHANGE, KEY_DBCONTEXT, KEY_GROUP_ID, KEY_GROUP_NAME, KEY_INDEX_NAMES, KEY_OU_ID, KEY_OU_NAME, KEY_PROJECTID, KEY_PUBLISHID, KEY_PUBLISHLIST, KEY_REPORT, KEY_RESOURCE, KEY_RESOURCES, KEY_SKIPINDEX, KEY_USER_ACTION, KEY_USER_CHANGES, KEY_USER_ID, KEY_USER_NAME, LISTENERS_FOR_ALL_EVENTS, VALUE_GROUP_MODIFIED_ACTION_CREATE, VALUE_GROUP_MODIFIED_ACTION_DELETE, VALUE_GROUP_MODIFIED_ACTION_WRITE, VALUE_OU_MODIFIED_ACTION_CREATE, VALUE_OU_MODIFIED_ACTION_DELETE, VALUE_USER_MODIFIED_ACTION_ADD_USER_TO_GROUP, VALUE_USER_MODIFIED_ACTION_CREATE_USER, VALUE_USER_MODIFIED_ACTION_DELETE_USER, VALUE_USER_MODIFIED_ACTION_REMOVE_USER_FROM_GROUP, VALUE_USER_MODIFIED_ACTION_RESET_PASSWORD, VALUE_USER_MODIFIED_ACTION_SET_OU, VALUE_USER_MODIFIED_ACTION_WRITE_USER
Constructor and Description |
---|
CmsSearchManager()
Default constructor when called as cron job.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnalyzer(CmsSearchAnalyzer analyzer)
Adds an analyzer.
|
void |
addDocumentTypeConfig(CmsSearchDocumentType documentType)
Adds a document type.
|
void |
addFieldConfiguration(CmsSearchFieldConfiguration fieldConfiguration)
Adds a search field configuration to the search manager.
|
void |
addSearchIndex(CmsSearchIndex searchIndex)
Adds a search index to the configuration.
|
void |
addSearchIndexSource(CmsSearchIndexSource searchIndexSource)
Adds a search index source configuration.
|
protected void |
cleanExtractionCache()
Cleans up the extraction result cache.
|
void |
cmsEvent(CmsEvent event)
Implements the event listener of this class.
|
protected java.util.List<CmsPublishedResource> |
findRelatedContainerPages(CmsObject adminCms,
java.util.List<CmsPublishedResource> updateResources)
Collects the related containerpages to the resources that have been published.
|
java.util.List<CmsSolrIndex> |
getAllSolrIndexes()
Returns all Solr index.
|
org.apache.lucene.analysis.Analyzer |
getAnalyzer(java.util.Locale locale)
Returns an analyzer for the given language.
|
static org.apache.lucene.analysis.Analyzer |
getAnalyzer(java.lang.String className)
Returns an analyzer for the given class name.
|
java.util.Map<java.util.Locale,CmsSearchAnalyzer> |
getAnalyzers()
Returns an unmodifiable view of the map that contains the
CmsSearchAnalyzer list. |
CmsSearchAnalyzer |
getCmsSearchAnalyzer(java.util.Locale locale)
Returns the search analyzer for the given locale.
|
java.lang.String |
getDirectory()
Returns the name of the directory below WEB-INF/ where the search indexes are stored.
|
java.lang.String |
getDirectorySolr()
Returns the configured Solr home directory
null if not set. |
I_CmsDocumentFactory |
getDocumentFactory(CmsResource resource)
Returns a lucene document factory for given resource.
|
I_CmsDocumentFactory |
getDocumentFactory(java.lang.String resourceType,
java.lang.String mimeType)
Returns a lucene document factory for given resource type and MIME type.
|
CmsSearchDocumentType |
getDocumentTypeConfig(java.lang.String name)
Returns a document type config.
|
java.util.List<CmsSearchDocumentType> |
getDocumentTypeConfigs()
Returns an unmodifiable view (read-only) of the DocumentTypeConfigs Map.
|
protected java.util.List<java.lang.String> |
getDocumentTypes()
Returns the set of names of all configured document types.
|
float |
getExtractionCacheMaxAge()
Returns the maximum age a text extraction result is kept in the cache (in hours).
|
CmsSearchFieldConfiguration |
getFieldConfiguration(java.lang.String name)
Returns the search field configuration with the given name.
|
java.util.List<CmsSearchFieldConfiguration> |
getFieldConfigurations()
Returns the unmodifieable List of configured
CmsSearchFieldConfiguration entries. |
java.util.List<CmsLuceneFieldConfiguration> |
getFieldConfigurationsLucene()
Returns the Lucene search field configurations only.
|
java.util.List<CmsSolrFieldConfiguration> |
getFieldConfigurationsSolr()
Returns the Solr search field configurations only.
|
CmsSearchManager.CmsSearchForceUnlockMode |
getForceunlock()
Returns the force unlock mode during indexing.
|
I_CmsTermHighlighter |
getHighlighter()
Returns the highlighter.
|
CmsSearchIndex |
getIndex(java.lang.String indexName)
Returns the Lucene search index configured with the given name.
|
int |
getIndexLockMaxWaitSeconds()
Returns the seconds to wait for an index lock during an update operation.
|
java.util.List<java.lang.String> |
getIndexNames()
Returns the names of all configured indexes.
|
static CmsSolrIndex |
getIndexSolr(CmsObject cms,
java.util.Map<java.lang.String,java.lang.String[]> params)
Returns the Solr index configured with the parameters name.
|
CmsSolrIndex |
getIndexSolr(java.lang.String indexName)
Returns the Solr index configured with the given name.
|
CmsSearchIndexSource |
getIndexSource(java.lang.String sourceName)
Returns a search index source for a specified source name.
|
int |
getMaxExcerptLength()
Returns the max. excerpt length.
|
long |
getMaxIndexWaitTime()
Returns the maximal time to wait for re-indexing after a content is edited (in milliseconds).
|
int |
getMaxModificationsBeforeCommit()
Returns the maximum number of modifications before a commit in the search index is triggered.
|
protected CmsProject |
getOfflineIndexProject()
Returns the a offline project used for offline indexing.
|
long |
getOfflineUpdateFrequency()
Returns the update frequency of the offline indexer in milliseconds.
|
java.util.List<CmsSearchIndex> |
getSearchIndexes()
Returns an unmodifiable list of all configured
instances. |
java.util.List<CmsSearchIndex> |
getSearchIndexesAll()
Returns an unmodifiable list of all configured
instances. |
java.util.List<CmsSolrIndex> |
getSearchIndexesSolr()
Returns an unmodifiable list of all configured
instances. |
java.util.Map<java.lang.String,CmsSearchIndexSource> |
getSearchIndexSources()
Returns an unmodifiable view (read-only) of the SearchIndexSources Map.
|
CmsSolrSpellchecker |
getSolrDictionary(CmsObject cms)
Return singleton instance of the OpenCms spellchecker.
|
CmsSolrConfiguration |
getSolrServerConfiguration()
Returns the Solr configuration.
|
protected CmsIndexingThreadManager |
getThreadManager()
Returns a new thread manager for the indexing threads.
|
long |
getTimeout()
Returns the timeout to abandon threads indexing a resource.
|
protected void |
initAvailableDocumentTypes()
Initializes the available Cms resource types to be indexed.
|
void |
initialize(CmsObject cms)
Initializes the search manager.
|
void |
initializeIndexes()
Initializes all configured document types and search indexes.
|
void |
initOfflineIndexes()
Initialize the offline index handler, require after an offline index has been added.
|
protected void |
initSearchIndexes()
Initializes the configured search indexes.
|
static boolean |
isLuceneIndex(java.lang.String indexName)
Returns
true if the index for the given name is a Lucene index, false otherwise. |
boolean |
isOfflineIndexingPaused()
Returns if the offline indexing is paused.
|
java.lang.String |
launch(CmsObject cms,
java.util.Map<java.lang.String,java.lang.String> parameters)
Updates the indexes from as a scheduled job.
|
void |
pauseOfflineIndexing()
Pauses the offline indexing.
|
void |
rebuildAllIndexes(I_CmsReport report)
Rebuilds (if required creates) all configured indexes.
|
void |
rebuildIndex(java.lang.String indexName,
I_CmsReport report)
Rebuilds (if required creates) the index with the given name.
|
void |
rebuildIndexes(java.util.List<java.lang.String> indexNames,
I_CmsReport report)
Rebuilds (if required creates) the List of indexes with the given name.
|
void |
registerSolrIndex(CmsSolrIndex index)
Registers a new Solr core for the given index.
|
boolean |
removeSearchFieldConfiguration(CmsSearchFieldConfiguration fieldConfiguration)
Removes this field configuration from the OpenCms configuration (if it is not used any more).
|
boolean |
removeSearchFieldConfigurationField(CmsSearchFieldConfiguration fieldConfiguration,
CmsSearchField field)
Removes a search field from the field configuration.
|
boolean |
removeSearchFieldMapping(CmsLuceneField field,
CmsSearchFieldMapping mapping)
Removes a search field mapping from the given field.
|
void |
removeSearchIndex(CmsSearchIndex searchIndex)
Removes a search index from the configuration.
|
void |
removeSearchIndexes(java.util.List<java.lang.String> indexNames)
Removes all indexes included in the given list (which must contain the name of an index to remove).
|
boolean |
removeSearchIndexSource(CmsSearchIndexSource indexsource)
Removes this indexsource from the OpenCms configuration (if it is not used any more).
|
void |
resumeOfflineIndexing()
Resumes offline indexing if it was paused.
|
void |
setDirectory(java.lang.String value)
Sets the name of the directory below WEB-INF/ where the search indexes are stored.
|
void |
setExtractionCacheMaxAge(float extractionCacheMaxAge)
Sets the maximum age a text extraction result is kept in the cache (in hours).
|
void |
setExtractionCacheMaxAge(java.lang.String extractionCacheMaxAge)
Sets the maximum age a text extraction result is kept in the cache (in hours) as a String.
|
void |
setForceunlock(java.lang.String value)
Sets the unlock mode during indexing.
|
void |
setHighlighter(java.lang.String highlighter)
Sets the highlighter.
|
void |
setIndexLockMaxWaitSeconds(int value)
Sets the seconds to wait for an index lock during an update operation.
|
void |
setMaxExcerptLength(int maxExcerptLength)
Sets the max. excerpt length.
|
void |
setMaxExcerptLength(java.lang.String maxExcerptLength)
Sets the max. excerpt length as a String.
|
void |
setMaxIndexWaitTime(long maxIndexWaitTime)
Sets the maximal wait time for offline index updates after edit operations.
|
void |
setMaxIndexWaitTime(java.lang.String maxIndexWaitTime)
Sets the maximal wait time for offline index updates after edit operations.
|
void |
setMaxModificationsBeforeCommit(int maxModificationsBeforeCommit)
Sets the maximum number of modifications before a commit in the search index is triggered.
|
void |
setMaxModificationsBeforeCommit(java.lang.String value)
Sets the maximum number of modifications before a commit in the search index is triggered as a string.
|
void |
setOfflineUpdateFrequency(long offlineUpdateFrequency)
Sets the update frequency of the offline indexer in milliseconds.
|
void |
setOfflineUpdateFrequency(java.lang.String offlineUpdateFrequency)
Sets the update frequency of the offline indexer in milliseconds.
|
void |
setSolrServerConfiguration(CmsSolrConfiguration config)
Sets the Solr configuration.
|
void |
setTimeout(long value)
Sets the timeout to abandon threads indexing a resource.
|
void |
setTimeout(java.lang.String value)
Sets the timeout to abandon threads indexing a resource as a String.
|
void |
shutDown()
Shuts down the search manager.
|
protected void |
updateAllIndexes(CmsObject adminCms,
CmsUUID publishHistoryId,
I_CmsReport report)
Incrementally updates all indexes that have their rebuild mode set to
"auto"
after resources have been published. |
protected void |
updateIndex(CmsSearchIndex index,
I_CmsReport report,
java.util.List<CmsPublishedResource> resourcesToIndex)
Updates (if required creates) the index with the given name.
|
protected void |
updateIndexIncremental(CmsObject cms,
CmsSearchIndex index,
I_CmsReport report,
java.util.List<CmsPublishedResource> resourcesToIndex)
Incrementally updates the given index.
|
protected void |
updateIndexOffline(I_CmsReport report,
java.util.List<CmsPublishedResource> resourcesToIndex)
Updates the offline search indexes for the given list of resources.
|
void |
updateOfflineIndexes()
Updates all offline indexes.
|
void |
updateOfflineIndexes(long waitTime)
Updates all offline indexes.
|
public static final int DEFAULT_EXCERPT_LENGTH
public static final float DEFAULT_EXTRACTION_CACHE_MAX_AGE
public static final int DEFAULT_MAX_MODIFICATIONS_BEFORE_COMMIT
public static final int DEFAULT_OFFLINE_UPDATE_FREQNENCY
public static final int DEFAULT_MAX_INDEX_WAITTIME
public static final int DEFAULT_TIMEOUT
public static final java.lang.String JOB_PARAM_INDEXLIST
public static final java.lang.String JOB_PARAM_WRITELOG
public static final java.lang.String LUCENE_ANALYZER
org.apache.lucene.analysis.
).protected static final org.apache.commons.logging.Log LOG
protected CmsObject m_adminCms
protected java.util.List<CmsSearchIndex> m_offlineIndexes
protected CmsSearchManager.CmsSearchOfflineIndexThread m_offlineIndexThread
public CmsSearchManager()
public static org.apache.lucene.analysis.Analyzer getAnalyzer(java.lang.String className) throws java.lang.Exception
className
- the class name of the analyzerjava.lang.Exception
- if something goes wrongpublic static final CmsSolrIndex getIndexSolr(CmsObject cms, java.util.Map<java.lang.String,java.lang.String[]> params)
null
is returned.cms
- the current contextparams
- the parameter mappublic static boolean isLuceneIndex(java.lang.String indexName)
true
if the index for the given name is a Lucene index, false
otherwise.indexName
- the name of the index to checktrue
if the index for the given name is a Lucene indexpublic void addAnalyzer(CmsSearchAnalyzer analyzer)
analyzer
- an analyzerpublic void addDocumentTypeConfig(CmsSearchDocumentType documentType)
documentType
- a document typepublic void addFieldConfiguration(CmsSearchFieldConfiguration fieldConfiguration)
fieldConfiguration
- the search field configuration to addpublic void addSearchIndex(CmsSearchIndex searchIndex)
searchIndex
- the search index to addpublic void addSearchIndexSource(CmsSearchIndexSource searchIndexSource)
searchIndexSource
- a search index source configurationpublic void cmsEvent(CmsEvent event)
cmsEvent
in interface I_CmsEventListener
event
- CmsEvent that has occurredI_CmsEventListener.cmsEvent(org.opencms.main.CmsEvent)
public java.util.List<CmsSolrIndex> getAllSolrIndexes()
public org.apache.lucene.analysis.Analyzer getAnalyzer(java.util.Locale locale) throws CmsSearchException
The analyzer is selected according to the analyzer configuration.
locale
- the locale to get the analyzer forCmsSearchException
- if something goes wrongpublic java.util.Map<java.util.Locale,CmsSearchAnalyzer> getAnalyzers()
CmsSearchAnalyzer
list.
The keys in the map are Locale
objects, and the values are CmsSearchAnalyzer
objects.
public CmsSearchAnalyzer getCmsSearchAnalyzer(java.util.Locale locale)
locale
- the locale to get the analyzer forpublic java.lang.String getDirectory()
public java.lang.String getDirectorySolr()
null
if not set.public I_CmsDocumentFactory getDocumentFactory(CmsResource resource)
The type of the document factory is selected by the type of the resource
and the MIME type of the resource content, according to the configuration in opencms-search.xml
.
resource
- a cms resourcepublic I_CmsDocumentFactory getDocumentFactory(java.lang.String resourceType, java.lang.String mimeType)
The type of the document factory is selected according to the configuration
in opencms-search.xml
.
resourceType
- the resource type namemimeType
- the MIME typepublic CmsSearchDocumentType getDocumentTypeConfig(java.lang.String name)
name
- the name of the document type configpublic java.util.List<CmsSearchDocumentType> getDocumentTypeConfigs()
public float getExtractionCacheMaxAge()
public CmsSearchFieldConfiguration getFieldConfiguration(java.lang.String name)
In case no configuration is available with the given name, null
is returned.
name
- the name to get the search field configuration forpublic java.util.List<CmsSearchFieldConfiguration> getFieldConfigurations()
CmsSearchFieldConfiguration
entries.CmsSearchFieldConfiguration
entriespublic java.util.List<CmsLuceneFieldConfiguration> getFieldConfigurationsLucene()
public java.util.List<CmsSolrFieldConfiguration> getFieldConfigurationsSolr()
public CmsSearchManager.CmsSearchForceUnlockMode getForceunlock()
public I_CmsTermHighlighter getHighlighter()
public CmsSearchIndex getIndex(java.lang.String indexName)
The index must exist, otherwise null
is returned.
indexName
- then name of the requested search indexpublic int getIndexLockMaxWaitSeconds()
public java.util.List<java.lang.String> getIndexNames()
public CmsSolrIndex getIndexSolr(java.lang.String indexName)
The index must exist, otherwise null
is returned.
indexName
- then name of the requested Solr indexpublic CmsSearchIndexSource getIndexSource(java.lang.String sourceName)
sourceName
- the name of the index sourcepublic int getMaxExcerptLength()
public long getMaxIndexWaitTime()
public int getMaxModificationsBeforeCommit()
public long getOfflineUpdateFrequency()
public java.util.List<CmsSearchIndex> getSearchIndexes()
CmsSearchIndex
instances.CmsSearchIndex
instancespublic java.util.List<CmsSearchIndex> getSearchIndexesAll()
CmsSearchIndex
instances.CmsSearchIndex
instancespublic java.util.List<CmsSolrIndex> getSearchIndexesSolr()
CmsSearchIndex
instances.CmsSearchIndex
instancespublic java.util.Map<java.lang.String,CmsSearchIndexSource> getSearchIndexSources()
public CmsSolrSpellchecker getSolrDictionary(CmsObject cms)
cms
- the cms object.public CmsSolrConfiguration getSolrServerConfiguration()
public long getTimeout()
public void initialize(CmsObject cms) throws CmsRoleViolationException
cms
- the cms objectCmsRoleViolationException
- in case the given opencms object does not have CmsRole.WORKPLACE_MANAGER
permissionspublic void initializeIndexes()
This methods needs to be called if after a change in the index configuration has been made.
public void initOfflineIndexes()
public boolean isOfflineIndexingPaused()
true
if the offline indexing is pausedpublic java.lang.String launch(CmsObject cms, java.util.Map<java.lang.String,java.lang.String> parameters) throws java.lang.Exception
launch
in interface I_CmsScheduledJob
cms
- the OpenCms user context to use when reading resources from the VFSparameters
- the parameters for the scheduled jobjava.lang.Exception
- if something goes wrongI_CmsScheduledJob.launch(CmsObject, Map)
public void pauseOfflineIndexing()
May take some time, because the indexes are updated first.
public void rebuildAllIndexes(I_CmsReport report) throws CmsException
report
- the report object to write messages (or null
)CmsException
- if something goes wrongpublic void rebuildIndex(java.lang.String indexName, I_CmsReport report) throws CmsException
indexName
- the name of the index to rebuildreport
- the report object to write messages (or null
)CmsException
- if something goes wrongpublic void rebuildIndexes(java.util.List<java.lang.String> indexNames, I_CmsReport report) throws CmsException
indexNames
- the names (String) of the index to rebuildreport
- the report object to write messages (or null
)CmsException
- if something goes wrongpublic void registerSolrIndex(CmsSolrIndex index) throws CmsConfigurationException
index
- the index to register a new Solr core forCmsConfigurationException
- if no Solr server is configuredpublic boolean removeSearchFieldConfiguration(CmsSearchFieldConfiguration fieldConfiguration) throws CmsIllegalStateException
fieldConfiguration
- the field configuration to remove from the configurationCmsIllegalStateException
- if the given field configuration is still used by at least one
CmsSearchIndex
.public boolean removeSearchFieldConfigurationField(CmsSearchFieldConfiguration fieldConfiguration, CmsSearchField field) throws CmsIllegalStateException
fieldConfiguration
- the field configurationfield
- field to remove from the field configurationCmsIllegalStateException
- if the given field is the last field inside the given field configuration.public boolean removeSearchFieldMapping(CmsLuceneField field, CmsSearchFieldMapping mapping) throws CmsIllegalStateException
field
- the fieldmapping
- mapping to remove from the fieldCmsIllegalStateException
- if the given mapping is the last mapping inside the given field.public void removeSearchIndex(CmsSearchIndex searchIndex)
searchIndex
- the search index to removepublic void removeSearchIndexes(java.util.List<java.lang.String> indexNames)
indexNames
- the names of the index to removepublic boolean removeSearchIndexSource(CmsSearchIndexSource indexsource) throws CmsIllegalStateException
indexsource
- the indexsource to remove from the configurationCmsIllegalStateException
- if the given indexsource is still used by at least one
CmsSearchIndex
.public void resumeOfflineIndexing()
public void setDirectory(java.lang.String value)
value
- the name of the directory below WEB-INF/ where the search indexes are storedpublic void setExtractionCacheMaxAge(float extractionCacheMaxAge)
extractionCacheMaxAge
- the maximum age for a text extraction result to setpublic void setExtractionCacheMaxAge(java.lang.String extractionCacheMaxAge)
extractionCacheMaxAge
- the maximum age for a text extraction result to setpublic void setForceunlock(java.lang.String value)
value
- the valuepublic void setHighlighter(java.lang.String highlighter)
A highlighter is a class implementing org.opencms.search.documents.I_TermHighlighter.
highlighter
- the package/class name of the highlighterpublic void setIndexLockMaxWaitSeconds(int value)
value
- the seconds to wait for an index lock during an update operationpublic void setMaxExcerptLength(int maxExcerptLength)
maxExcerptLength
- the max. excerpt length to setpublic void setMaxExcerptLength(java.lang.String maxExcerptLength)
maxExcerptLength
- the max. excerpt length to setpublic void setMaxIndexWaitTime(long maxIndexWaitTime)
maxIndexWaitTime
- the maximal wait time to set in millisecondspublic void setMaxIndexWaitTime(java.lang.String maxIndexWaitTime)
maxIndexWaitTime
- the maximal wait time to set in millisecondspublic void setMaxModificationsBeforeCommit(int maxModificationsBeforeCommit)
maxModificationsBeforeCommit
- the maximum number of modifications to setpublic void setMaxModificationsBeforeCommit(java.lang.String value)
value
- the maximum number of modifications to setpublic void setOfflineUpdateFrequency(long offlineUpdateFrequency)
offlineUpdateFrequency
- the update frequency in milliseconds to setpublic void setOfflineUpdateFrequency(java.lang.String offlineUpdateFrequency)
offlineUpdateFrequency
- the update frequency in milliseconds to setpublic void setSolrServerConfiguration(CmsSolrConfiguration config)
config
- the Solr configurationpublic void setTimeout(long value)
value
- the timeout in millisecondspublic void setTimeout(java.lang.String value)
value
- the timeout in millisecondspublic void shutDown()
This will cause all search indices to be shut down.
public void updateOfflineIndexes()
Can be used to force an index update when it's not convenient to wait until the offline update interval has eclipsed.
Since the offline indexes still need some time to update the new resources,
the method waits for at most the configurable maxIndexWaitTime
to ensure that updating is finished.
updateOfflineIndexes(long)
public void updateOfflineIndexes(long waitTime)
Can be used to force an index update when it's not convenient to wait until the offline update interval has eclipsed.
Since the offline index will still need some time to update the new resources even if it runs directly, a wait time of 2500 or so should be given in order to make sure the index finished updating.
waitTime
- milliseconds to wait after the offline update index was notified of the changesprotected void cleanExtractionCache()
protected java.util.List<CmsPublishedResource> findRelatedContainerPages(CmsObject adminCms, java.util.List<CmsPublishedResource> updateResources)
adminCms
- an OpenCms user context with Admin permissionsupdateResources
- the resources to be re-indexedprotected java.util.List<java.lang.String> getDocumentTypes()
protected CmsProject getOfflineIndexProject()
protected CmsIndexingThreadManager getThreadManager()
protected void initAvailableDocumentTypes()
A map stores document factories keyed by a string representing a colon separated list of Cms resource types and/or mimetypes.
The keys of this map are used to trigger a document factory to convert a Cms resource into a Lucene index document.
A document factory is a class implementing the interface
I_CmsDocumentFactory
.
protected void initSearchIndexes()
This initializes also the list of Cms resources types to be indexed by an index source.
protected void updateAllIndexes(CmsObject adminCms, CmsUUID publishHistoryId, I_CmsReport report)
"auto"
after resources have been published.adminCms
- an OpenCms user context with Admin permissionspublishHistoryId
- the history ID of the published projectreport
- the report to write the output toprotected void updateIndex(CmsSearchIndex index, I_CmsReport report, java.util.List<CmsPublishedResource> resourcesToIndex) throws CmsException
If the optional List of
instances is provided, the index will be
incrementally updated for these resources only. If this List is CmsPublishedResource
null
or empty,
the index will be fully rebuild.
index
- the index to update or rebuildreport
- the report to write output messages toresourcesToIndex
- an (optional) list of CmsPublishedResource
objects to update in the indexCmsException
- if something goes wrongprotected void updateIndexIncremental(CmsObject cms, CmsSearchIndex index, I_CmsReport report, java.util.List<CmsPublishedResource> resourcesToIndex) throws CmsException
cms
- the OpenCms user context to use for accessing the VFSindex
- the index to updatereport
- the report to write output messages toresourcesToIndex
- a list of CmsPublishedResource
objects to update in the indexCmsException
- if something goes wrongprotected void updateIndexOffline(I_CmsReport report, java.util.List<CmsPublishedResource> resourcesToIndex)
report
- the report to write the index information toresourcesToIndex
- the list of CmsPublishedResource
objects to index