diff --git a/src/main/java/io/anserini/search/query/QueryEncoder.java b/src/main/java/io/anserini/search/query/QueryEncoder.java index 0f65b6bd6b..ee4fb3380e 100644 --- a/src/main/java/io/anserini/search/query/QueryEncoder.java +++ b/src/main/java/io/anserini/search/query/QueryEncoder.java @@ -22,13 +22,23 @@ public abstract class QueryEncoder { static protected Path getModelPath(String modelName, String modelURL) throws IOException { File modelFile = new File(getCacheDir(), modelName); - FileUtils.copyURLToFile(new URL(modelURL), modelFile); + if (!modelFile.exists()) { + System.out.println("Downloading model"); + FileUtils.copyURLToFile(new URL(modelURL), modelFile); + } else{ + System.out.println("Model already exists"); + } return modelFile.toPath(); } static protected Path getVocabPath(String vocabName, String vocabURL) throws IOException { File vocabFile = new File(getCacheDir(), vocabName); - FileUtils.copyURLToFile(new URL(vocabURL), vocabFile); + if (!vocabFile.exists()) { + System.out.println("Downloading vocab"); + FileUtils.copyURLToFile(new URL(vocabURL), vocabFile); + } else{ + System.out.println("Vocab already exists"); + } return vocabFile.toPath(); }