/** * @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#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); } } } }
indexer.deleteResource(writer, new CmsPublishedResource(res));