Revision 7856
Added by Jing Tao over 11 years ago
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/SolrIndex.java | ||
---|---|---|
391 | 391 |
} |
392 | 392 |
} |
393 | 393 |
if(!solrDoc.isEmpty()) { |
394 |
IndexEvent event = new IndexEvent(); |
|
394 |
/*IndexEvent event = new IndexEvent();
|
|
395 | 395 |
event.setDate(Calendar.getInstance().getTime()); |
396 | 396 |
Identifier pid = new Identifier(); |
397 | 397 |
pid.setValue(doc.getIdentifier()); |
398 |
event.setIdentifier(pid); |
|
398 |
event.setIdentifier(pid);*/
|
|
399 | 399 |
try { |
400 | 400 |
UpdateResponse response = solrServer.add(solrDoc); |
401 | 401 |
solrServer.commit(); |
... | ... | |
407 | 407 |
log.error("SolrIndex.insertToIndex - IndexEventLog can't log the index inserting event :"+e.getMessage()); |
408 | 408 |
}*/ |
409 | 409 |
} catch (SolrServerException e) { |
410 |
event.setAction(Event.CREATE); |
|
410 |
/*event.setAction(Event.CREATE);
|
|
411 | 411 |
event.setDescription("Failed to insert the solr index for the id "+pid.getValue()+" since "+e.getMessage()); |
412 | 412 |
try { |
413 | 413 |
EventlogFactory.createIndexEventLog().write(event); |
414 | 414 |
} catch (Exception ee) { |
415 | 415 |
log.error("SolrIndex.insertToIndex - IndexEventLog can't log the index inserting event :"+ee.getMessage()); |
416 |
} |
|
416 |
}*/
|
|
417 | 417 |
throw e; |
418 | 418 |
} catch (IOException e) { |
419 |
event.setAction(Event.CREATE); |
|
419 |
/*event.setAction(Event.CREATE);
|
|
420 | 420 |
event.setDescription("Failed to insert the solr index for the id "+pid.getValue()+" since "+e.getMessage()); |
421 | 421 |
try { |
422 | 422 |
EventlogFactory.createIndexEventLog().write(event); |
423 | 423 |
} catch (Exception ee) { |
424 | 424 |
log.error("SolrIndex.insertToIndex - IndexEventLog can't log the index inserting event :"+ee.getMessage()); |
425 |
} |
|
425 |
}*/
|
|
426 | 426 |
throw e; |
427 | 427 |
|
428 | 428 |
} |
... | ... | |
622 | 622 |
*/ |
623 | 623 |
private void removeFromIndex(String pid) throws SolrServerException, IOException { |
624 | 624 |
if(pid != null && !pid.trim().equals("")) { |
625 |
IndexEvent event = new IndexEvent(); |
|
625 |
/*IndexEvent event = new IndexEvent();
|
|
626 | 626 |
event.setDate(Calendar.getInstance().getTime()); |
627 | 627 |
Identifier identifier = new Identifier(); |
628 | 628 |
identifier.setValue(pid); |
629 |
event.setIdentifier(identifier); |
|
629 |
event.setIdentifier(identifier);*/
|
|
630 | 630 |
try { |
631 | 631 |
solrServer.deleteById(pid); |
632 | 632 |
solrServer.commit(); |
... | ... | |
638 | 638 |
log.error("SolrIndex.removeFromIndex - IndexEventLog can't log the index deleting event :"+e.getMessage()); |
639 | 639 |
}*/ |
640 | 640 |
} catch (SolrServerException e) { |
641 |
event.setAction(Event.DELETE); |
|
641 |
/*event.setAction(Event.DELETE);
|
|
642 | 642 |
event.setDescription("Failurely remove the solr index for the id "+identifier.getValue()+" since "+e.getMessage()); |
643 | 643 |
try { |
644 | 644 |
EventlogFactory.createIndexEventLog().write(event); |
645 | 645 |
} catch (Exception ee) { |
646 | 646 |
log.error("SolrIndex.removeFromIndex - IndexEventLog can't log the index deleting event :"+ee.getMessage()); |
647 |
} |
|
647 |
}*/
|
|
648 | 648 |
throw e; |
649 | 649 |
|
650 | 650 |
} catch (IOException e) { |
651 |
event.setAction(Event.DELETE); |
|
651 |
/*event.setAction(Event.DELETE);
|
|
652 | 652 |
event.setDescription("Failurely remove the solr index for the id "+identifier.getValue()+" since "+e.getMessage()); |
653 | 653 |
try { |
654 | 654 |
EventlogFactory.createIndexEventLog().write(event); |
655 | 655 |
} catch (Exception ee) { |
656 | 656 |
log.error("SolrIndex.removeFromIndex - IndexEventLog can't log the index deleting event :"+ee.getMessage()); |
657 |
} |
|
657 |
}*/
|
|
658 | 658 |
throw e; |
659 | 659 |
} |
660 | 660 |
|
Also available in: Unified diff
Remove the EventLog write.