/** * @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; }
updateData.addResourceToUpdate(pubRes); } else { updateData.addResourceToDelete(pubRes); updateData.addResourceToUpdate(pubRes); updateData.addResourceToDelete(pubRes); } else if (pubRes.getState().isChanged() || pubRes.getState().isUnchanged()) { if (pubRes.getPublishTag() < 0) { updateData.addResourceToUpdate(pubRes); } else { updateData.addResourceToDelete(pubRes); updateData.addResourceToUpdate(pubRes);
if (!updateData.isEmpty()) { hasResourcesToDelete = hasResourcesToDelete | updateData.hasResourcesToDelete(); hasResourcesToUpdate = hasResourcesToUpdate | updateData.hasResourceToUpdate(); while (i.hasNext()) { CmsSearchIndexUpdateData updateCollection = i.next(); if (updateCollection.hasResourcesToDelete()) { updateCollection.getIndexer().deleteResources( writer, updateCollection.getResourcesToDelete()); while (i.hasNext()) { CmsSearchIndexUpdateData updateCollection = i.next(); if (updateCollection.hasResourceToUpdate()) { updateCollection.getIndexer().updateResources( writer, threadManager, updateCollection.getResourcesToUpdate());
if (!updateData.isEmpty()) { hasResourcesToDelete = hasResourcesToDelete | updateData.hasResourcesToDelete(); hasResourcesToUpdate = hasResourcesToUpdate | updateData.hasResourceToUpdate(); while (i.hasNext()) { CmsSearchIndexUpdateData updateCollection = i.next(); if (updateCollection.hasResourcesToDelete()) { updateCollection.getIndexer().deleteResources( writer, updateCollection.getResourcesToDelete()); while (i.hasNext()) { CmsSearchIndexUpdateData updateCollection = i.next(); if (updateCollection.hasResourceToUpdate()) { updateCollection.getIndexer().updateResources( writer, threadManager, updateCollection.getResourcesToUpdate());
/** * Adds a given published resource to the provided search index update data.<p> * * This method decides if the resource has to be included in the "update" or "delete" list.<p> * * @param pubRes the published resource to add * @param updateData the search index update data to add the resource to */ protected void addResourceToUpdateData(CmsPublishedResource pubRes, CmsSearchIndexUpdateData updateData) { if (pubRes.getState().isDeleted()) { // deleted resource just needs to be removed updateData.addResourceToDelete(pubRes); } else if (pubRes.getState().isNew() || pubRes.getState().isChanged() || pubRes.getState().isUnchanged()) { updateData.addResourceToUpdate(pubRes); } }
/** * @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; }
CmsSearchIndexUpdateData result = new CmsSearchIndexUpdateData(source, this); Iterator<CmsPublishedResource> i = publishedResources.iterator(); while (i.hasNext()) {