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
FieldsModifier and TypeFieldDescriptionprotected CmsObjectThe OpenCms user context to use when reading resources from the VFS during indexing.protected I_CmsSearchIndexThe index.protected I_CmsReportThe report. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddResourceToUpdateData(CmsPublishedResource pubRes, CmsSearchIndexUpdateData updateData) Adds a given published resource to the provided search index update data.protected voiddeleteResource(I_CmsIndexWriter indexWriter, CmsPublishedResource resource) Deletes a resource with the given index writer.voiddeleteResources(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.booleanThe default indexer is not able to resolve locale dependencies between documents.protected booleanisResourceInTimeWindow(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.voidrebuildIndex(I_CmsIndexWriter writer, CmsIndexingThreadManager threadManager, CmsSearchIndexSource source) Rebuilds the index for the given configured index source.protected voidupdateResource(I_CmsIndexWriter indexWriter, String rootPath, I_CmsSearchDocument doc) Updates a resource with the given index writer and the new document provided.protected voidupdateResource(I_CmsIndexWriter writer, CmsIndexingThreadManager threadManager, CmsResource resource) Updates (writes) a single resource in the index.voidupdateResources(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_CmsIndexerIncremental index update - delete the index entry for all resources in the given list.- Specified by:
deleteResourcesin interfaceI_CmsIndexer- Parameters:
indexWriter- the writer to the index to delete the entries fromresourcesToDelete- a list ofinstances 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_CmsIndexerCalculates the data for an incremental search index update.- Specified by:
getUpdateDatain interfaceI_CmsIndexer- Parameters:
source- the search index source to updatepublishedResources- a list ofobjects 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:
isLocaleDependenciesEnablein interfaceI_CmsIndexer- Returns:
trueif this VFS indexer is able to resolve locale dependencies between documents- See Also:
-
newInstance
Description copied from interface:I_CmsIndexerCreates and initializes a new instance of this indexer implementation.- Specified by:
newInstancein 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_CmsIndexerRebuilds 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:
rebuildIndexin 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_CmsIndexerIncremental index update - create a new index entry for all resources in the given list.- Specified by:
updateResourcesin interfaceI_CmsIndexer- Parameters:
writer- the index writer to write the update tothreadManager- the thread manager to use when extracting the document textresourcesToUpdate- a list ofinstances 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
-