+ public static void unindexID (String id,String index) throws IOException{
+ IndexReader indexReader = null;
+ try{
+ indexReader = IndexReader.open(index);
+ indexReader.delete(new Term("id",id));
+ indexReader.close();
+ }
+ catch(Exception e){
+ if (indexReader != null){
+ indexReader.close();
+ }
+ }
+ finally {
+ if (indexReader != null){
+ FSDirectory theIndexDir=FSDirectory.getDirectory(index,false);
+ if (IndexReader.isLocked(theIndexDir)){
+ IndexReader.unlock(theIndexDir);
+ }
+ }
+ }
+ }