diff options
-rw-r--r-- | application/src/main/java/com/yahoo/application/Application.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/application/src/main/java/com/yahoo/application/Application.java b/application/src/main/java/com/yahoo/application/Application.java index 899e9d8675c..5d8123de48f 100644 --- a/application/src/main/java/com/yahoo/application/Application.java +++ b/application/src/main/java/com/yahoo/application/Application.java @@ -82,8 +82,7 @@ public final class Application implements AutoCloseable { this.deletePathWhenClosing = deletePathWhenClosing; contentClusters = ContentCluster.fromPath(path); container = JDisc.fromPath(path, networking, createVespaModel().configModelRepo()); - QueryProfileXMLReader queryProfileXMLReader = new QueryProfileXMLReader(); - compiledQueryProfileRegistry = queryProfileXMLReader.read(path + "/search/query-profiles").compile(); + compiledQueryProfileRegistry = readQueryProfilesFromApplicationPackage(path); } @Beta @@ -128,6 +127,17 @@ public final class Application implements AutoCloseable { return fromApplicationPackage(file.toPath(), networking); } + private CompiledQueryProfileRegistry readQueryProfilesFromApplicationPackage(Path path) { + String queryProfilePath = path + "/search/query-profiles"; + QueryProfileXMLReader queryProfileXMLReader = new QueryProfileXMLReader(); + + File f = new File(queryProfilePath); + if(f.exists() && f.isDirectory()) { + return queryProfileXMLReader.read(queryProfilePath).compile(); + } + return CompiledQueryProfileRegistry.empty; + } + private VespaModel createVespaModel() { try { List<MlModelImporter> modelImporters = List.of(new VespaImporter(), |