1 6 package org.roller.business.search.operations; 7 8 import java.io.IOException ; 9 10 import org.apache.commons.logging.Log; 11 import org.apache.commons.logging.LogFactory; 12 import org.apache.lucene.index.IndexReader; 13 import org.apache.lucene.index.Term; 14 import org.roller.business.IndexManagerImpl; 15 import org.roller.business.search.FieldConstants; 16 import org.roller.pojos.WeblogEntryData; 17 18 19 24 public class RemoveEntryOperation extends WriteToIndexOperation 25 { 26 28 private static Log mLogger = 29 LogFactory.getFactory().getInstance(RemoveEntryOperation.class); 30 31 33 private WeblogEntryData data; 34 35 37 40 public RemoveEntryOperation(IndexManagerImpl mgr, WeblogEntryData data) 41 { 42 super(mgr); 43 this.data = data; 44 } 45 46 48 51 public void doRun() 52 { 53 IndexReader reader = beginDeleting(); 54 try 55 { 56 if (reader != null) 57 { 58 Term term = new Term(FieldConstants.ID, data.getId()); 59 reader.delete(term); 60 } 61 } 62 catch (IOException e) 63 { 64 mLogger.error("Error deleting doc from index", e); 65 } 66 finally 67 { 68 endDeleting(); 69 } 70 } 71 72 73 } 74 | Popular Tags |