Revision 7800
Added by Jing Tao about 11 years ago
SolrIndex.java | ||
---|---|---|
31 | 31 |
import java.io.IOException; |
32 | 32 |
import java.io.InputStream; |
33 | 33 |
import java.util.ArrayList; |
34 |
import java.util.Calendar; |
|
34 | 35 |
import java.util.HashMap; |
35 | 36 |
import java.util.Iterator; |
36 | 37 |
import java.util.List; |
... | ... | |
79 | 80 |
import org.w3c.dom.NameList; |
80 | 81 |
import org.xml.sax.SAXException; |
81 | 82 |
|
83 |
import edu.ucsb.nceas.metacat.index.event.EventlogFactory; |
|
84 |
import edu.ucsb.nceas.metacat.index.event.IndexEvent; |
|
82 | 85 |
import edu.ucsb.nceas.metacat.index.resourcemap.ResourceMapSubprocessor; |
83 | 86 |
|
84 | 87 |
/** |
... | ... | |
392 | 395 |
if(!solrDoc.isEmpty()) { |
393 | 396 |
UpdateResponse response = solrServer.add(solrDoc); |
394 | 397 |
solrServer.commit(); |
398 |
IndexEvent event = new IndexEvent(); |
|
399 |
event.setType(IndexEvent.SUCCESSINSERT); |
|
400 |
event.setDate(Calendar.getInstance().getTime()); |
|
401 |
Identifier pid = new Identifier(); |
|
402 |
pid.setValue(doc.getIdentifier()); |
|
403 |
event.setPid(pid); |
|
404 |
event.setDescription("Successfully insert the solr index for the id "+pid.getValue()); |
|
405 |
try { |
|
406 |
EventlogFactory.createIndexEventLog().write(event); |
|
407 |
} catch (Exception e) { |
|
408 |
log.error("SolrIndex.insertToIndex - IndexEventLog can't insert the solr doc to the solr server :"+e.getMessage()); |
|
409 |
} |
|
410 |
|
|
395 | 411 |
//System.out.println("=================the response is:\n"+response.toString()); |
396 | 412 |
} |
397 | 413 |
} |
... | ... | |
590 | 606 |
if(pid != null && !pid.trim().equals("")) { |
591 | 607 |
solrServer.deleteById(pid); |
592 | 608 |
solrServer.commit(); |
609 |
IndexEvent event = new IndexEvent(); |
|
610 |
event.setType(IndexEvent.SUCCESSINSERT); |
|
611 |
event.setDate(Calendar.getInstance().getTime()); |
|
612 |
Identifier identifier = new Identifier(); |
|
613 |
identifier.setValue(pid); |
|
614 |
event.setPid(identifier); |
|
615 |
event.setDescription("Successfully remove the solr index for the id "+identifier.getValue()); |
|
616 |
try { |
|
617 |
EventlogFactory.createIndexEventLog().write(event); |
|
618 |
} catch (Exception e) { |
|
619 |
log.error("SolrIndex.insertToIndex - IndexEventLog can't insert the solr doc to the solr server :"+e.getMessage()); |
|
620 |
} |
|
593 | 621 |
} |
594 | 622 |
} |
595 | 623 |
|
Also available in: Unified diff
Add a temporary file log for debugging.