Index: metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/IndexGenerator.java
===================================================================
--- metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/IndexGenerator.java	(revision 7856)
+++ metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/IndexGenerator.java	(revision 7857)
@@ -30,6 +30,7 @@
 import java.io.FileNotFoundException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 import java.util.TimerTask;
@@ -43,6 +44,7 @@
 import org.dataone.service.exceptions.NotAuthorized;
 import org.dataone.service.exceptions.NotImplemented;
 import org.dataone.service.exceptions.ServiceFailure;
+import org.dataone.service.types.v1.Event;
 import org.dataone.service.types.v1.Identifier;
 import org.dataone.service.types.v1.ObjectFormatIdentifier;
 import org.dataone.service.types.v1.SystemMetadata;
@@ -219,24 +221,26 @@
         
         //add the failedPids 
         List<IndexEvent> failedEvents = EventlogFactory.createIndexEventLog().getEvents(null, null, null, null);
-        List<String> failedOtherIds = new ArrayList<String>();
-        List<String> failedResourceMapIds = new ArrayList<String>();
+        List<IndexEvent> failedOtherIds = new ArrayList<IndexEvent>();
+        List<IndexEvent> failedResourceMapIds = new ArrayList<IndexEvent>();
         if(failedEvents != null) {
             for(IndexEvent event : failedEvents) {
             	String id = event.getIdentifier().getValue();
                 SystemMetadata sysmeta = getSystemMetadata(id);
-                if(sysmeta != null && !sysmeta.getArchived()) {
+                if(sysmeta != null) {
                     ObjectFormatIdentifier formatId =sysmeta.getFormatId();
                     if(formatId != null && formatId.getValue() != null && resourceMapNamespaces != null && isResourceMap(formatId)) {
-                        failedResourceMapIds.add(id);
+                        failedResourceMapIds.add(event);
                     } else {
-                        failedOtherIds.add(id);
+                        failedOtherIds.add(event);
                     }
                 }
             }
         }
+        indexFailedIds(failedOtherIds);
+        indexFailedIds(failedResourceMapIds);
         
-        if(!failedOtherIds.isEmpty()) {
+        /*if(!failedOtherIds.isEmpty()) {
             failedOtherIds.addAll(otherMetacatIds);
         } else {
             failedOtherIds = otherMetacatIds;
@@ -246,12 +250,12 @@
             failedResourceMapIds.addAll(resourceMapIds);
         } else {
             failedResourceMapIds = resourceMapIds;
-        }
+        }*/
         
-        log.info("the metacat ids (exception resource map -----------------------------"+failedOtherIds);
-        log.info("the metacat resroucemap ids -----------------------------"+failedResourceMapIds);
-        index(failedOtherIds);
-        index(failedResourceMapIds);
+        log.info("the metacat ids (except the resource map ids)-----------------------------"+otherMetacatIds);
+        log.info("the metacat resroucemap ids -----------------------------"+resourceMapIds);
+        index(otherMetacatIds);
+        index(resourceMapIds);
        
         //record the timed index.
         if(processedDate != null) {
@@ -270,7 +274,20 @@
                         try {
                             generateIndex(metacatId);
                         } catch (Exception e) {
-                            log.error("IndexGenerator.index - Metacat Index couldn't generate the index for the id - "+metacatId+" because "+e.getMessage());
+                            IndexEvent event = new IndexEvent();
+                            Identifier pid = new Identifier();
+                            pid.setValue(metacatId);
+                            event.setIdentifier(pid);
+                            event.setDate(Calendar.getInstance().getTime());
+                            event.setAction(Event.CREATE);
+                            String error = "IndexGenerator.index - Metacat Index couldn't generate the index for the id - "+metacatId+" because "+e.getMessage();
+                            event.setDescription(error);
+                            try {
+                                EventlogFactory.createIndexEventLog().write(event);
+                            } catch (Exception ee) {
+                                log.error("SolrIndex.insertToIndex - IndexEventLog can't log the index inserting event :"+ee.getMessage());
+                            }
+                            log.error(error);
                         }
                         
                    
@@ -279,6 +296,40 @@
         }
     }
     
+    /*
+     * Index those ids which failed in the process (We got them from the EventLog)
+     */
+    private void indexFailedIds(List<IndexEvent> events) {
+        if(events != null) {
+            for(IndexEvent event : events) {
+                if(event != null) {
+                    Identifier identifier = event.getIdentifier();
+                    if(identifier != null) {
+                        String id = identifier.getValue();
+                        if(id != null) {
+                            Event action = event.getAction();
+                            if (action != null && action.equals(Event.CREATE)) {
+                                try {
+                                    generateIndex(id);
+                                    EventlogFactory.createIndexEventLog().remove(identifier);
+                                } catch (Exception e) {
+                                    log.error("IndexGenerator.indexFailedIds - Metacat Index couldn't generate the index for the id - "+id+" because "+e.getMessage());
+                                }
+                            } else if (action != null && action.equals(Event.DELETE)) {
+                                try {
+                                    removeIndex(id);
+                                    EventlogFactory.createIndexEventLog().remove(identifier);
+                                } catch (Exception e) {
+                                    log.error("IndexGenerator.indexFailedIds - Metacat Index couldn't remove the index for the id - "+id+" because "+e.getMessage());
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+    
     public void run() {
         /*IndexEvent event = new IndexEvent();
         event.setDate(Calendar.getInstance().getTime());
@@ -472,6 +523,15 @@
     }
     
     /*
+     * Remove the index for the id
+     */
+    private void removeIndex(String id) throws Exception {
+        if(id != null) {
+            solrIndex.remove(id);
+        }
+    }
+    
+    /*
      * Initialize the system metadata map
      */
     private void initSystemMetadataMap() throws FileNotFoundException, ServiceFailure{
