Skip to content
Browse files

Improved exception handling, if the event doesn't correspond to the

schema
  • Loading branch information...
1 parent b5ab6f6 commit 0f3db96ea9faa529a4f4682ed078eaaf86d0b0db vzhabiuk committed Apr 20, 2012
Showing with 29 additions and 25 deletions.
  1. +29 −25 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/LuceneIndexDataLoader.java
View
54 zoie-core/src/main/java/proj/zoie/impl/indexing/internal/LuceneIndexDataLoader.java
@@ -171,31 +171,35 @@ public void consume(Collection<DataEvent<ZoieIndexable>> events) throws ZoieExce
addList.remove(uid);
if (!indexable.isDeleted()) // update event
{
- IndexingReq[] reqs = indexable.buildIndexingReqs();
- for (IndexingReq req : reqs) {
- if (req != null) // if doc is provided, interpret as
- // a delete, e.g. update with
- // nothing
- {
- Document doc = req.getDocument();
- if (doc!=null){
- ZoieSegmentReader.fillDocumentID(doc, uid);
- if (indexable.isStorable()){
- byte[] bytes = indexable.getStoreValue();
- if (bytes!=null){
- doc.add(new Field(AbstractZoieIndexable.DOCUMENT_STORE_FIELD,bytes));
- }
- }
- }
- // add to the insert list
- List<IndexingReq> docList = addList.get(uid);
- if (docList == null) {
- docList = new LinkedList<IndexingReq>();
- addList.put(uid, docList);
- }
- docList.add(req);
- }
- }
+ try {
+ IndexingReq[] reqs = indexable.buildIndexingReqs();
+ for (IndexingReq req : reqs) {
+ if (req != null) // if doc is provided, interpret as
+ // a delete, e.g. update with
+ // nothing
+ {
+ Document doc = req.getDocument();
+ if (doc!=null){
+ ZoieSegmentReader.fillDocumentID(doc, uid);
+ if (indexable.isStorable()){
+ byte[] bytes = indexable.getStoreValue();
+ if (bytes!=null){
+ doc.add(new Field(AbstractZoieIndexable.DOCUMENT_STORE_FIELD,bytes));
+ }
+ }
+ }
+ // add to the insert list
+ List<IndexingReq> docList = addList.get(uid);
+ if (docList == null) {
+ docList = new LinkedList<IndexingReq>();
+ addList.put(uid, docList);
+ }
+ docList.add(req);
+ }
+ }
+ } catch (Exception ex) {
+ log.error("Couldn't index the event with uid - " + uid, ex);
+ }
}
// hao: we do not need the following few lines
//else {

0 comments on commit 0f3db96

Please sign in to comment.
Something went wrong with that request. Please try again.