public static IndexDeletionPolicy getIndexDeletionPolicy(Config config) {String deletionPolicyName = config.get("deletion.policy", "org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy");if (deletionPolicyName.equals(NoDeletionPolicy.class.getName())) {return NoDeletionPolicy.INSTANCE;} else {try {return Class.forName(deletionPolicyName).asSubclass(IndexDeletionPolicy.class).getConstructor().newInstance();} catch (Exception e) {}}}
public static IndexDeletionPolicy GetIndexDeletionPolicy(Config config){string deletionPolicyName = config.Get("deletion.policy", "Lucene.Net.Index.KeepOnlyLastCommitDeletionPolicy, Lucene.Net");Type deletionPolicyType = Type.GetType(deletionPolicyName);if (deletionPolicyType == null){throw new Exception("Unrecognized deletion policy type '" + deletionPolicyName + "'");}else if (deletionPolicyType.Equals(typeof(NoDeletionPolicy))){return NoDeletionPolicy.INSTANCE;}else{try{return (IndexDeletionPolicy)Activator.CreateInstance(deletionPolicyType);}catch (Exception e){}}}