Project

General

Profile

« Previous | Next » 

Revision 8991

Added by Jing Tao about 10 years ago

Fixed a bug that the reindex of data objects may index an archived data object.

View differences:

src/edu/ucsb/nceas/metacat/dataone/SystemMetadataFactory.java
657 657
	private static void reindexDataFile(Identifier id, SystemMetadata sysmeta) {
658 658
	    try {
659 659
	        logMetacat.debug("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ reindex"+id.getValue());
660
	        //set the archive to true to remove index.
661
	        sysmeta.setArchived(true);
662
            MetacatSolrIndex.getInstance().submit(id, sysmeta, null, true);
663
            //re-insert the index
664
            sysmeta.setArchived(false);
665
            MetacatSolrIndex.getInstance().submit(id, sysmeta, null, true);
660
	        if(sysmeta != null) {
661
	            if(!sysmeta.getArchived()) {
662
	                //set the archive to true to remove index.
663
	                sysmeta.setArchived(true);
664
	                MetacatSolrIndex.getInstance().submit(id, sysmeta, null, true);
665
	                //re-insert the index
666
	                sysmeta.setArchived(false);
667
	                MetacatSolrIndex.getInstance().submit(id, sysmeta, null, true);
668
	            } else {
669
	                MetacatSolrIndex.getInstance().submit(id, sysmeta, null, true);
670
	            }
671
	        }
672
	       
666 673
        } catch (Exception e) {
667 674
            // TODO Auto-generated catch block
668 675
            logMetacat.warn("Can't reindex the data object "+id.getValue()+" since "+e.getMessage());

Also available in: Unified diff