Package org.opencms.search
Class CmsVfsIndexer
java.lang.Object
org.opencms.search.CmsVfsIndexer
- All Implemented Interfaces:
I_CmsIndexer
- Direct Known Subclasses:
CmsDependencyIndexer
An indexer indexing
CmsResource
based content from the OpenCms VFS.- Since:
- 6.0.0
-
Field Summary
Modifier and TypeFieldDescriptionprotected CmsObject
The OpenCms user context to use when reading resources from the VFS during indexing.protected I_CmsSearchIndex
The index.protected I_CmsReport
The report. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addResourceToUpdateData
(CmsPublishedResource pubRes, CmsSearchIndexUpdateData updateData) Adds a given published resource to the provided search index update data.protected void
deleteResource
(I_CmsIndexWriter indexWriter, CmsPublishedResource resource) Deletes a resource with the given index writer.void
deleteResources
(I_CmsIndexWriter indexWriter, List<CmsPublishedResource> resourcesToDelete) Incremental index update - delete the index entry for all resources in the given list.getCms()
Returns the OpenCms user context used by this indexer.getIndex()
Returns the OpenCms search index updated by this indexer.Returns the report used by this indexer.getUpdateData
(CmsSearchIndexSource source, List<CmsPublishedResource> publishedResources) Calculates the data for an incremental search index update.boolean
The default indexer is not able to resolve locale dependencies between documents.protected boolean
isResourceInTimeWindow
(CmsPublishedResource resource) Checks if the published resource is inside the time window set with release and expiration date.newInstance
(CmsObject cms, I_CmsReport report, I_CmsSearchIndex index) Creates and initializes a new instance of this indexer implementation.void
rebuildIndex
(I_CmsIndexWriter writer, CmsIndexingThreadManager threadManager, CmsSearchIndexSource source) Rebuilds the index for the given configured index source.protected void
updateResource
(I_CmsIndexWriter indexWriter, String rootPath, I_CmsSearchDocument doc) Updates a resource with the given index writer and the new document provided.protected void
updateResource
(I_CmsIndexWriter writer, CmsIndexingThreadManager threadManager, CmsResource resource) Updates (writes) a single resource in the index.void
updateResources
(I_CmsIndexWriter writer, CmsIndexingThreadManager threadManager, List<CmsPublishedResource> resourcesToUpdate) Incremental index update - create a new index entry for all resources in the given list.
-
Field Details
-
m_cms
The OpenCms user context to use when reading resources from the VFS during indexing. -
m_index
The index. -
m_report
The report.
-
-
Constructor Details
-
CmsVfsIndexer
public CmsVfsIndexer()
-
-
Method Details
-
deleteResources
public void deleteResources(I_CmsIndexWriter indexWriter, List<CmsPublishedResource> resourcesToDelete) Description copied from interface:I_CmsIndexer
Incremental index update - delete the index entry for all resources in the given list.- Specified by:
deleteResources
in interfaceI_CmsIndexer
- Parameters:
indexWriter
- the writer to the index to delete the entries fromresourcesToDelete
- a list of
instances that must be deletedCmsPublishedResource
- See Also:
-
getCms
Returns the OpenCms user context used by this indexer.- Returns:
- the OpenCms user context used by this indexer
-
getIndex
Returns the OpenCms search index updated by this indexer.- Returns:
- the OpenCms search index updated by this indexer
-
getReport
Returns the report used by this indexer.- Returns:
- the report used by this indexer
-
getUpdateData
public CmsSearchIndexUpdateData getUpdateData(CmsSearchIndexSource source, List<CmsPublishedResource> publishedResources) Description copied from interface:I_CmsIndexer
Calculates the data for an incremental search index update.- Specified by:
getUpdateData
in interfaceI_CmsIndexer
- Parameters:
source
- the search index source to updatepublishedResources
- a list of
objects that are to be updatedCmsPublishedResource
- Returns:
- a container with the information about the resources to delete and / or update
- See Also:
-
isLocaleDependenciesEnable
The default indexer is not able to resolve locale dependencies between documents.- Specified by:
isLocaleDependenciesEnable
in interfaceI_CmsIndexer
- Returns:
true
if this VFS indexer is able to resolve locale dependencies between documents- See Also:
-
newInstance
Description copied from interface:I_CmsIndexer
Creates and initializes a new instance of this indexer implementation.- Specified by:
newInstance
in interfaceI_CmsIndexer
- Parameters:
cms
- the OpenCms user context to use when reading resources from the VFS during indexingreport
- the report to write the indexing output toindex
- the search index to update- Returns:
- a new instance of this indexer implementation
- See Also:
-
rebuildIndex
public void rebuildIndex(I_CmsIndexWriter writer, CmsIndexingThreadManager threadManager, CmsSearchIndexSource source) Description copied from interface:I_CmsIndexer
Rebuilds the index for the given configured index source.This is used when the index is fully rebuild, not for updating only some parts of an existing index.
- Specified by:
rebuildIndex
in interfaceI_CmsIndexer
- Parameters:
writer
- the index writer to write the update tothreadManager
- the thread manager to use when extracting the document textsource
- the search index source to update- See Also:
-
updateResources
public void updateResources(I_CmsIndexWriter writer, CmsIndexingThreadManager threadManager, List<CmsPublishedResource> resourcesToUpdate) Description copied from interface:I_CmsIndexer
Incremental index update - create a new index entry for all resources in the given list.- Specified by:
updateResources
in interfaceI_CmsIndexer
- Parameters:
writer
- the index writer to write the update tothreadManager
- the thread manager to use when extracting the document textresourcesToUpdate
- a list of
instances that must be updatedCmsPublishedResource
- See Also:
-
addResourceToUpdateData
protected void addResourceToUpdateData(CmsPublishedResource pubRes, CmsSearchIndexUpdateData updateData) Adds a given published resource to the provided search index update data.This method decides if the resource has to be included in the "update" or "delete" list.
- Parameters:
pubRes
- the published resource to addupdateData
- the search index update data to add the resource to
-
deleteResource
Deletes a resource with the given index writer.- Parameters:
indexWriter
- the index writer to resource the resource withresource
- the root path of the resource to delete
-
isResourceInTimeWindow
Checks if the published resource is inside the time window set with release and expiration date.- Parameters:
resource
- the published resource to check- Returns:
- true if the published resource is inside the time window, otherwise false
-
updateResource
protected void updateResource(I_CmsIndexWriter writer, CmsIndexingThreadManager threadManager, CmsResource resource) Updates (writes) a single resource in the index.- Parameters:
writer
- the index writer to usethreadManager
- the thread manager to use when extracting the document textresource
- the resource to update
-
updateResource
protected void updateResource(I_CmsIndexWriter indexWriter, String rootPath, I_CmsSearchDocument doc) Updates a resource with the given index writer and the new document provided.- Parameters:
indexWriter
- the index writer to update the resource withrootPath
- the root path of the resource to updatedoc
- the new document for the resource
-