/** * @see org.opencms.search.I_CmsIndexer#deleteResources(org.apache.lucene.index.IndexWriter, java.util.List) */ public void deleteResources(I_CmsIndexWriter indexWriter, List<CmsPublishedResource> resourcesToDelete) { if ((resourcesToDelete == null) || resourcesToDelete.isEmpty()) { // nothing to delete return; } // contains all resources already deleted to avoid multiple deleting in case of siblings List<String> resourcesAlreadyDeleted = new ArrayList<String>(resourcesToDelete.size()); Iterator<CmsPublishedResource> i = resourcesToDelete.iterator(); while (i.hasNext()) { // iterate all resources in the given list of resources to delete CmsPublishedResource res = i.next(); String rootPath = res.getRootPath(); if (!resourcesAlreadyDeleted.contains(rootPath)) { // ensure siblings are only deleted once per update resourcesAlreadyDeleted.add(rootPath); if (!res.isFolder()) { // now delete the resource from the index deleteResource(indexWriter, rootPath); } } } }
/** * @see org.opencms.search.I_CmsIndexer#newInstance(org.opencms.file.CmsObject, org.opencms.report.I_CmsReport, org.opencms.search.CmsSearchIndex) */ public I_CmsIndexer newInstance(CmsObject cms, I_CmsReport report, CmsSearchIndex index) { CmsVfsIndexer indexer = new CmsVfsIndexer(); indexer.m_cms = cms; indexer.m_report = report; indexer.m_index = index; return indexer; }
I_CmsReport report = indexer.getReport(); m_startedCounter++; CmsIndexingThread thread = new CmsIndexingThread( indexer.getCms(), res, indexer.getIndex(), m_startedCounter, report); if (doc != null) { indexer.updateResource(writer, res.getRootPath(), doc); } else { indexer.deleteResource(writer, new CmsPublishedResource(res)); Messages.get().getBundle().key( Messages.LOG_IO_INDEX_WRITER_COMMIT_2, indexer.getIndex().getName(), indexer.getIndex().getPath()), e);
updateResource(writer, threadManager, resource);
/** * @see org.opencms.search.I_CmsIndexer#getUpdateData(org.opencms.search.CmsSearchIndexSource, java.util.List) */ public CmsSearchIndexUpdateData getUpdateData( CmsSearchIndexSource source, List<CmsPublishedResource> publishedResources) { // create a new update collection from this indexer and the given index source CmsSearchIndexUpdateData result = new CmsSearchIndexUpdateData(source, this); Iterator<CmsPublishedResource> i = publishedResources.iterator(); while (i.hasNext()) { // check all published resources if they match this indexer / source CmsPublishedResource pubRes = i.next(); // VFS resources will always have a structure id if (!pubRes.getStructureId().isNullUUID()) { // use utility method from CmsProject to check if published resource is "inside" this index source if (CmsProject.isInsideProject(source.getResourcesNames(), pubRes.getRootPath())) { // the resource is "inside" this index source addResourceToUpdateData(pubRes, result); } } } return result; }
if (isResourceInTimeWindow(pubRes)) { if (pubRes.getPublishTag() < 0) { if (isResourceInTimeWindow(pubRes)) {
updateResource(writer, threadManager, resource);
/** * @see org.opencms.search.I_CmsIndexer#getUpdateData(org.opencms.search.CmsSearchIndexSource, java.util.List) */ public CmsSearchIndexUpdateData getUpdateData( CmsSearchIndexSource source, List<CmsPublishedResource> publishedResources) { // create a new update collection from this indexer and the given index source CmsSearchIndexUpdateData result = new CmsSearchIndexUpdateData(source, this); Iterator<CmsPublishedResource> i = publishedResources.iterator(); while (i.hasNext()) { // check all published resources if they match this indexer / source CmsPublishedResource pubRes = i.next(); // VFS resources will always have a structure id if (!pubRes.getStructureId().isNullUUID()) { // use utility method from CmsProject to check if published resource is "inside" this index source if (CmsProject.isInsideProject(source.getResourcesNames(), pubRes.getRootPath())) { // the resource is "inside" this index source addResourceToUpdateData(pubRes, result); } } } return result; }
updateResource(writer, threadManager, resource);
/** * @see org.opencms.search.I_CmsIndexer#deleteResources(org.opencms.search.I_CmsIndexWriter, java.util.List) */ public void deleteResources(I_CmsIndexWriter indexWriter, List<CmsPublishedResource> resourcesToDelete) { if ((resourcesToDelete == null) || resourcesToDelete.isEmpty()) { // nothing to delete return; } // contains all resources already deleted to avoid multiple deleting in case of siblings List<CmsUUID> resourcesAlreadyDeleted = new ArrayList<CmsUUID>(resourcesToDelete.size()); Iterator<CmsPublishedResource> i = resourcesToDelete.iterator(); while (i.hasNext()) { // iterate all resources in the given list of resources to delete CmsPublishedResource res = i.next(); if (!resourcesAlreadyDeleted.contains(res.getStructureId())) { // ensure siblings are only deleted once per update resourcesAlreadyDeleted.add(res.getStructureId()); if (!res.isFolder() && !CmsResource.isTemporaryFileName(res.getRootPath())) { // now delete the resource from the index deleteResource(indexWriter, res); } } } }
updateResource(writer, threadManager, resource);