public interface I_CmsSearchIndex extends I_CmsConfigurationParameterHandler, java.io.Serializable
CmsSearchManager
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REBUILD_MODE_AUTO
Automatic ("auto") index rebuild mode.
|
static java.lang.String |
REBUILD_MODE_MANUAL
Manual ("manual") index rebuild mode.
|
static java.lang.String |
REBUILD_MODE_NEVER
Never ("never") index rebuild mode for indexes that should never be updated via OpenCms.
|
static java.lang.String |
REBUILD_MODE_OFFLINE
Offline ("offline") index rebuild mode.
|
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD
Modifier and Type | Method and Description |
---|---|
void |
addSourceName(java.lang.String sourceName)
Adds am index source to this search index.
|
boolean |
checkConfiguration(CmsObject cms)
Checks is this index has been configured correctly.
|
I_CmsSearchDocument |
createEmptyDocument(CmsResource resource)
Creates an empty document that can be used by this search field configuration.
|
boolean |
excludeFromIndex(CmsObject cms,
CmsResource resource)
Checks if the provided resource should be excluded from this search index.
|
I_CmsExtractionResult |
getContentIfUnchanged(CmsResource resource)
The method should return the extraction result of a content from the index, if sure the
content has not changed since last indexing.
|
I_CmsDocumentFactory |
getDocumentFactory(CmsResource res)
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. |
I_CmsSearchFieldConfiguration |
getFieldConfiguration()
Returns the search field configuration of this index.
|
java.lang.String |
getFieldConfigurationName()
Returns the name of the field configuration used for this index.
|
I_CmsIndexWriter |
getIndexWriter(I_CmsReport report,
boolean create)
Returns a new index writer for this index.
|
java.util.Locale |
getLocale()
Returns the language locale of this index.
|
java.util.Locale |
getLocaleForResource(CmsObject cms,
CmsResource resource,
java.util.List<java.util.Locale> availableLocales)
Returns the language locale for the given resource in this index.
|
java.lang.String |
getName()
Gets the name of this index.
|
java.lang.String |
getPath()
Returns the path where this index stores it's data in the "real" file system.
|
java.lang.String |
getProject()
Gets the project of this index.
|
java.lang.String |
getRebuildMode()
Get the rebuild mode of this index.
|
java.util.List<java.lang.String> |
getSourceNames()
Returns all configured sources names of this search index.
|
java.util.List<CmsSearchIndexSource> |
getSources()
Returns all configured index sources of this search index.
|
void |
initialize()
Initializes the search index.
|
boolean |
isEnabled()
Returns
true if this index is currently disabled. |
boolean |
isExtractingContent()
Returns
true if full text is extracted by this index. |
boolean |
isInitialized()
Returns a flag, indicating if the search index is successfully initialized.
|
boolean |
isLanguageDetection()
Returns the languageDetection.
|
boolean |
isUpdatedIncremental()
Returns
true in case this index is updated incremental. |
void |
onIndexChanged(boolean force)
Method called by the search manager if the index has changed.
|
void |
removeSourceName(java.lang.String sourceName)
Removes an index source from this search index.
|
void |
setEnabled(boolean enabled)
Can be used to enable / disable this index.
|
void |
setFieldConfigurationName(java.lang.String fieldConfigurationName)
Sets the name of the field configuration used for this index.
|
void |
setLocale(java.util.Locale locale)
Sets the locale to index resources.
|
void |
setLocaleString(java.lang.String locale)
Sets the locale to index resources as a String.
|
void |
setName(java.lang.String name)
Sets the logical key/name of this search index.
|
void |
setProject(java.lang.String project)
Sets the name of the project used to index resources.
|
void |
setRebuildMode(java.lang.String rebuildMode)
Sets the rebuild mode of this search index.
|
void |
shutDown()
Shuts down the search index.
|
addConfigurationParameter, getConfiguration, initConfiguration
static final java.lang.String REBUILD_MODE_AUTO
static final java.lang.String REBUILD_MODE_MANUAL
static final java.lang.String REBUILD_MODE_OFFLINE
static final java.lang.String REBUILD_MODE_NEVER
I_CmsExtractionResult getContentIfUnchanged(CmsResource resource)
null
.resource
- the resource the content should be provided for.null
,
if no up-to-date extraction result can be obtained from the index.java.lang.String getFieldConfigurationName()
java.util.Locale getLocaleForResource(CmsObject cms, CmsResource resource, java.util.List<java.util.Locale> availableLocales)
cms
- the current OpenCms user contextresource
- the resource to checkavailableLocales
- a list of locales supported by the resourcejava.util.List<java.lang.String> getSourceNames()
boolean isExtractingContent()
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.
true
if full text is extracted by this indexboolean isLanguageDetection()
boolean isUpdatedIncremental()
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.
true
in case this index is updated incrementalvoid removeSourceName(java.lang.String sourceName)
sourceName
- the index source name to removevoid setLocale(java.util.Locale locale)
locale
- the locale to index resourcesvoid addSourceName(java.lang.String sourceName)
sourceName
- the index source name to addboolean checkConfiguration(CmsObject cms)
In case the check fails, the enabled
property
is set to false
cms
- a OpenCms user context to perform the checks with (should have "Administrator" permissions)true
in case the index is correctly configured and enabled after the checkisEnabled()
I_CmsSearchDocument createEmptyDocument(CmsResource resource)
resource
- the resource to create the document forboolean excludeFromIndex(CmsObject cms, CmsResource resource)
cms
- the OpenCms context used for building the search indexresource
- the resource to indexI_CmsDocumentFactory getDocumentFactory(CmsResource res)
null
in case the resource is not indexed by this index.A resource is indexed if the following is all true:
res
- the resource to checknull
in case the resource is not indexed by this indexI_CmsSearchFieldConfiguration getFieldConfiguration()
I_CmsIndexWriter getIndexWriter(I_CmsReport report, boolean create) throws CmsIndexException
report
- the report to write error messages oncreate
- if true
a whole new index is created, if false
an existing index is updatedCmsIndexException
- if the index can not be openedjava.util.Locale getLocale()
java.lang.String getName()
java.lang.String getPath()
java.lang.String getProject()
java.lang.String getRebuildMode()
java.util.List<CmsSearchIndexSource> getSources()
void initialize() throws CmsSearchException
CmsSearchException
- if the index source association failed or a configuration error occurredboolean isEnabled()
true
if this index is currently disabled.true
if this index is currently disabledboolean isInitialized()
void onIndexChanged(boolean force)
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.void setEnabled(boolean enabled)
enabled
- the state of the index to setvoid setFieldConfigurationName(java.lang.String fieldConfigurationName)
fieldConfigurationName
- the name of the field configuration to setvoid setLocaleString(java.lang.String locale)
locale
- the locale to index resourcessetLocale(Locale)
void setName(java.lang.String name) throws CmsIllegalArgumentException
name
- the logical key/name of this search indexCmsIllegalArgumentException
- if the given name is null, empty or already taken by another search indexvoid setProject(java.lang.String project)
project
- the name of the project used to index resourcesvoid setRebuildMode(java.lang.String rebuildMode)
rebuildMode
- the rebuild mode of this search index {auto|manual}void shutDown()
This will close the local Lucene index searcher instance.