aboutsummaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorbjormel <bjormel@verizonmedia.com>2022-07-26 19:09:28 +0200
committerbjormel <bjormel@verizonmedia.com>2022-07-26 19:09:28 +0200
commit1ff6fcce424328bb99b8eeb89c1df8c5cc4ca60a (patch)
tree16bec2a4af9938ae3d5721ffa75197c3e9121ef1 /application
parent4cb41a4347641813d134b573ac7caf27d3951640 (diff)
Default to empty CompiledQueryProfileRegistry
Diffstat (limited to 'application')
-rw-r--r--application/src/main/java/com/yahoo/application/Application.java14
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(),