- public static void unindexEntity (EntityContent entity,String index) throws IOException{
- IndexReader indexReader = null;
- try{
- indexReader = IndexReader.open(index);
- indexReader.delete(new Term("id",entity.getValue("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);
- }
- }
- }
+ public static void unindexEntity (EntityContent anEntity, String anIndex) throws IOException{
+ unindexID(anEntity.getId(), anIndex);