summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-02-01 22:53:49 +0100
committerJon Bratseth <bratseth@gmail.com>2022-02-01 22:53:49 +0100
commitd91569194fe13bed6c2fef28fc9b5633d6299a5f (patch)
tree7f63050b0c743e693ab120f99d4babefb417af03
parentd492c5c573a561bc67a8bd0478d94e616817eaeb (diff)
Support searchdefinitions/ legacy dir
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java
index 134fc4dc5a2..533546b4d39 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java
@@ -204,9 +204,7 @@ public class ApplicationBuilder {
private Schema parseSchema(String schemaString) throws ParseException {
SimpleCharStream stream = new SimpleCharStream(schemaString);
try {
- return new SDParser(stream, applicationPackage, fileRegistry, deployLogger, properties,
- rankProfileRegistry, documentsOnly)
- .schema(documentTypeManager);
+ return parserOf(stream).schema(documentTypeManager);
} catch (TokenMgrException e) {
throw new ParseException("Unknown symbol: " + e.getMessage());
} catch (ParseException pe) {
@@ -216,10 +214,14 @@ public class ApplicationBuilder {
private void addRankProfileFiles(Schema schema) {
if (applicationPackage == null) return;
+
+ Path legacyRankProfilePath = ApplicationPackage.SEARCH_DEFINITIONS_DIR.append(schema.getName());
+ for (NamedReader reader : applicationPackage.getFiles(legacyRankProfilePath, ".profile"))
+ parseRankProfile(reader, schema);
+
Path rankProfilePath = ApplicationPackage.SCHEMAS_DIR.append(schema.getName());
- for (NamedReader reader : applicationPackage.getFiles(rankProfilePath, ".profile")) {
+ for (NamedReader reader : applicationPackage.getFiles(rankProfilePath, ".profile"))
parseRankProfile(reader, schema);
- }
}
/** Parses the rank profile of the given reader and adds it to the rank profile registry for this schema. */
@@ -227,9 +229,7 @@ public class ApplicationBuilder {
try {
SimpleCharStream stream = new SimpleCharStream(IOUtils.readAll(reader.getReader()));
try {
- new SDParser(stream, applicationPackage, fileRegistry, deployLogger, properties,
- rankProfileRegistry, documentsOnly)
- .rankProfile(schema);
+ parserOf(stream).rankProfile(schema);
} catch (TokenMgrException e) {
throw new ParseException("Unknown symbol: " + e.getMessage());
} catch (ParseException pe) {
@@ -244,7 +244,10 @@ public class ApplicationBuilder {
}
}
-
+ private SDParser parserOf(SimpleCharStream stream) {
+ return new SDParser(stream, applicationPackage, fileRegistry, deployLogger, properties,
+ rankProfileRegistry, documentsOnly);
+ }
/**
* Processes and finalizes the schemas of this.