summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/SummaryInFieldLongOperation.java10
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedDocument.java8
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedRankFunction.java21
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedRankProfile.java53
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedSchema.java10
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryField.java36
-rw-r--r--config-model/src/main/javacc/IntermediateParser.jj162
-rw-r--r--config-model/src/main/javacc/SDParser.jj6
8 files changed, 169 insertions, 137 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/SummaryInFieldLongOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/SummaryInFieldLongOperation.java
index 8661928699f..f776f7b1cec 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/SummaryInFieldLongOperation.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/SummaryInFieldLongOperation.java
@@ -18,7 +18,6 @@ public class SummaryInFieldLongOperation extends SummaryInFieldOperation {
private DataType type;
private Boolean bold;
private Set<String> destinations = new java.util.LinkedHashSet<>();
- private List<SummaryField.Property> properties = new ArrayList<>();
public SummaryInFieldLongOperation(String name) {
super(name);
@@ -44,11 +43,6 @@ public class SummaryInFieldLongOperation extends SummaryInFieldOperation {
return destinations.iterator();
}
-
- public void addProperty(SummaryField.Property property) {
- properties.add(property);
- }
-
public void apply(SDField field) {
if (type == null) {
type = field.getDataType();
@@ -74,9 +68,5 @@ public class SummaryInFieldLongOperation extends SummaryInFieldOperation {
for (String destination : destinations) {
summary.addDestination(destination);
}
-
- for (SummaryField.Property prop : properties) {
- summary.addProperty(prop.getName(), prop.getValue());
- }
}
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedDocument.java b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedDocument.java
index 29dd36c1d25..6bde4759eb7 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedDocument.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedDocument.java
@@ -4,6 +4,12 @@ package com.yahoo.searchdefinition.parser;
import java.util.ArrayList;
import java.util.List;
+/**
+ * This class holds the extracted information after parsing a
+ * "document" block in a schema (.sd) file, using simple data
+ * structures as far as possible. Do not put advanced logic here!
+ * @author arnej27959
+ **/
public class ParsedDocument {
private final String name;
private final List<String> inherited = new ArrayList<>();
@@ -12,7 +18,7 @@ public class ParsedDocument {
this.name = name;
}
- String getName() { return name; }
+ String name() { return name; }
void inherit(String other) { inherited.add(other); }
/*
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedRankFunction.java b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedRankFunction.java
new file mode 100644
index 00000000000..9f843ca15a7
--- /dev/null
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedRankFunction.java
@@ -0,0 +1,21 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.searchdefinition.parser;
+
+/**
+ * This class holds the extracted information after parsing a
+ * "function" block in a rank-profile, using simple data structures as
+ * far as possible. Do not put advanced logic here!
+ * @author arnej27959
+ **/
+class ParsedRankFunction {
+
+ private final String name;
+
+ ParsedRankFunction(String name) {
+ this.name = name;
+ }
+
+ void addParameter(String param) {}
+ void setInline(boolean inline) {}
+ void setExpression(String expr) {}
+}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedRankProfile.java b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedRankProfile.java
new file mode 100644
index 00000000000..16b7b507121
--- /dev/null
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedRankProfile.java
@@ -0,0 +1,53 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.searchdefinition.parser;
+
+import com.yahoo.searchdefinition.RankProfile.MatchPhaseSettings;
+import com.yahoo.searchdefinition.RankProfile.MutateOperation;
+import com.yahoo.searchlib.rankingexpression.FeatureList;
+import com.yahoo.searchlib.rankingexpression.evaluation.TensorValue;
+import com.yahoo.searchlib.rankingexpression.evaluation.Value;
+
+/**
+ * This class holds the extracted information after parsing a
+ * rank-profile block in a schema (.sd) file, using simple data
+ * structures as far as possible. Do not put advanced logic here!
+ * @author arnej27959
+ **/
+class ParsedRankProfile {
+
+ private final String name;
+
+ ParsedRankProfile(String name) {
+ this.name = name;
+ }
+
+ public String name() { return name; }
+
+ void addSummaryFeatures(FeatureList features) {}
+ void addMatchFeatures(FeatureList features) {}
+ void addRankFeatures(FeatureList features) {}
+
+ void inherit(String other) {}
+ void setInheritedSummaryFeatures(String other) {}
+
+ void addFieldRankType(String field, String type) {}
+ void addFieldRankWeight(String field, int weight) {}
+ void addFieldRankFilter(String field, boolean filter) {}
+ void setSecondPhaseRanking(String expression) {}
+ void setRerankCount(int count) {}
+ void setFirstPhaseRanking(String expression) {}
+ void setKeepRankCount(int count) {}
+ void setRankScoreDropLimit(double limit) {}
+ void setMatchPhaseSettings(MatchPhaseSettings settings) {}
+ void addFunction(ParsedRankFunction func) {}
+ void addMutateOperation(MutateOperation.Phase phase, String attrName, String operation) {}
+ void setIgnoreDefaultRankFeatures(boolean ignore) {}
+ void setNumThreadsPerSearch(int threads) {}
+ void setMinHitsPerThread(int minHits) {}
+ void setNumSearchPartitions(int numParts) {}
+ void setTermwiseLimit(double limit) {}
+ void setInheritedMatchFeatures(String other) {}
+ void addRankProperty(String key, String value) {}
+ void addConstant(String name, Value value) {}
+ void addConstantTensor(String name, TensorValue value) {}
+}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedSchema.java b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedSchema.java
index 6026cf55beb..85e20b2f714 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedSchema.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedSchema.java
@@ -8,6 +8,12 @@ import com.yahoo.searchdefinition.document.Stemming;
import java.util.ArrayList;
import java.util.List;
+/**
+ * This class holds the extracted information after parsing
+ * one schema (.sd) file, using simple data structures
+ * as far as possible. Do not put advanced logic here!
+ * @author arnej27959
+ **/
public class ParsedSchema {
private final String name;
private final List<String> inherited = new ArrayList<>();
@@ -16,12 +22,13 @@ public class ParsedSchema {
this.name = name;
}
- String getName() { return name; }
+ String name() { return name; }
void addDocument(ParsedDocument document) {}
void addImportedField(String asFieldName, String refFieldName, String foregnFieldName) {}
void addOnnxModel(OnnxModel model) {}
void addRankingConstant(RankingConstant constant) {}
+ void addRankProfile(ParsedRankProfile profile) {}
void enableRawAsBase64(boolean value) {}
void inherit(String other) { inherited.add(other); }
void setStemming(Stemming value) {}
@@ -35,7 +42,6 @@ public class ParsedSchema {
void addStruct(ParsedStruct struct) {}
void addFieldSet(ParsedFieldSet fieldSet) {}
void addDocumentSummary(ParsedDocumentSummary docsum) {}
- void addRankProfile(ParsedRankProfile profile) {}
*/
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryField.java b/config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryField.java
index 75a2a808a89..da3070af55f 100644
--- a/config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryField.java
+++ b/config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryField.java
@@ -53,30 +53,6 @@ public class SummaryField extends Field implements Cloneable, TypedKey {
}
- /** A name-value property (used for smart summary) */
- public static class Property implements Serializable {
- private String name;
- private String value;
- public Property(String name, String value) {
- this.name = name;
- this.value = value;
- }
- public String getName() { return name; }
- public String getValue() { return value; }
- @Override
- public int hashCode() {
- return name.hashCode() + 17*value.hashCode();
- }
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof Property)) {
- return false;
- }
- Property other = (Property)obj;
- return name.equals(other.name) && value.equals(other.value);
- }
- }
-
/** The transform to perform on the stored source */
private SummaryTransform transform=SummaryTransform.NONE;
@@ -96,9 +72,6 @@ public class SummaryField extends Field implements Cloneable, TypedKey {
/** True if this field was defined implicitly */
private boolean implicit=false;
- /** The list of properties for this summary field */
- private List<Property> properties = new ArrayList<>();
-
/** Creates a summary field with NONE as transform */
public SummaryField(String name, DataType type) {
this(name,type, SummaryTransform.NONE);
@@ -298,15 +271,6 @@ public class SummaryField extends Field implements Cloneable, TypedKey {
this.vsmCommand = vsmCommand;
}
- /** Adds a property to this summary field */
- public void addProperty(String name, String value) {
- properties.add(new Property(name, value));
- }
-
- public List<Property> getProperties() {
- return properties;
- }
-
/**
* The command used when using data from this SummaryField to generate StreamingSummary config (vsmsummary).
* Not used for ordinary Summary config.
diff --git a/config-model/src/main/javacc/IntermediateParser.jj b/config-model/src/main/javacc/IntermediateParser.jj
index 6e69cc4624a..a6482ca0b81 100644
--- a/config-model/src/main/javacc/IntermediateParser.jj
+++ b/config-model/src/main/javacc/IntermediateParser.jj
@@ -1,8 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-// Schema parser.
-//
-// NOTE: When this is changed, also change integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf
+// Duplicate Schema parser - work in progress
+// @author arnej27959
+// NOTE: When grammar is changed, also change integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf
options {
UNICODE_INPUT = true;
@@ -441,11 +441,11 @@ void rootSchemaItem(ParsedSchema schema) : { }
| importField(schema)
| rankingConstant(schema)
| useDocument(schema)
+ | rankProfile(schema)
/*
| documentSummary(schema)
| field(null, schema)
| index(schema, null)
- | rankProfile(schema)
| structOutside(schema)
| annotationOutside(schema)
| fieldSet(schema)
@@ -496,7 +496,7 @@ void useDocument(ParsedSchema schema) : { }
*/
void document(ParsedSchema schema) :
{
- String name = schema.getName();
+ String name = schema.name();
ParsedDocument document;
}
{
@@ -536,9 +536,9 @@ void documentBody(ParsedDocument document) :
{
}
{
- ( compression(null)
- | headercfg(null)
- | bodycfg(null)
+ ( compression()
+ | headercfg()
+ | bodycfg()
/* | annotation(schema, document)
| structInside(document, schema)
| field(document, schema) */
@@ -562,30 +562,24 @@ void rawAsBase64(ParsedSchema schema) :
/**
* Consumes a document head block.
- *
- * @param document The document type to modify.
*/
-void headercfg(SDDocumentType document) : { }
+void headercfg() : { }
{
- <HEADER> lbrace() [compression(document) (<NL>)*] <RBRACE>
+ <HEADER> lbrace() [compression() (<NL>)*] <RBRACE>
}
/**
* Consumes a document body block.
- *
- * @param document The document type to modify.
*/
-void bodycfg(SDDocumentType document) : { }
+void bodycfg() : { }
{
- <BODY> lbrace() [compression(document) (<NL>)*] <RBRACE>
+ <BODY> lbrace() [compression() (<NL>)*] <RBRACE>
}
/**
* Consumes a compression block. This can be set in both document header and -body block.
- *
- * @param document The document type to modify.
*/
-void compression(SDDocumentType document) :
+void compression() :
{
deployLogger.logApplicationPackage(Level.WARNING, "'compression' for a document is deprecated and ignored");
}
@@ -595,7 +589,6 @@ void compression(SDDocumentType document) :
/**
* Consumes the body of a compression block.
- *
*/
void compressionItem() :
{ }
@@ -1428,7 +1421,7 @@ void summaryProperty(SummaryInFieldLongOperation field) :
}
{
name = identifierWithDash() <COLON> (value = identifierWithDash() | value = quotedString())
- { field.addProperty(new SummaryField.Property(name, value)); }
+ { deployLogger.logApplicationPackage(Level.WARNING, "Specifying summary properties is deprecated and has no effect."); }
}
/**
@@ -1947,37 +1940,30 @@ String rankingConstantErrorMessage(String name) : {}
*
* @param schema the schema object to add content to
*/
-void rankProfile(Schema schema) :
+void rankProfile(ParsedSchema schema) :
{
String name;
- RankProfile profile;
+ ParsedRankProfile profile;
}
{
( ( <MODEL> | <RANKPROFILE> ) name = identifierWithDash()
{
- if (documentsOnly) {
- profile = new DocumentsOnlyRankProfile(name, schema, rankProfileRegistry, schema.rankingConstants());
- }
- else if ("default".equals(name)) {
- profile = rankProfileRegistry.get(schema, "default");
- } else {
- profile = new RankProfile(name, schema, rankProfileRegistry, schema.rankingConstants());
- }
+ profile = new ParsedRankProfile(name);
}
[inheritsRankProfile(profile)]
lbrace() (rankProfileItem(profile) (<NL>)*)* <RBRACE> )
{
- if (documentsOnly) return;
- rankProfileRegistry.add(profile);
+ schema.addRankProfile(profile);
}
}
+
/**
* This rule consumes a single statement for a rank-profile block.
*
* @param profile The rank profile to modify.
*/
-void rankProfileItem(RankProfile profile) : { }
+void rankProfileItem(ParsedRankProfile profile) : { }
{
( fieldRankType(profile)
| fieldWeight(profile)
@@ -1994,7 +1980,7 @@ void rankProfileItem(RankProfile profile) : { }
| rankFeatures(profile)
| rankProperties(profile)
| secondPhase(profile)
- | rankDegradation(profile)
+ | rankDegradation()
| constants(profile)
| matchFeatures(profile)
| summaryFeatures(profile) )
@@ -2005,13 +1991,13 @@ void rankProfileItem(RankProfile profile) : { }
*
* @param profile the profile to modify
*/
-void inheritsRankProfile(RankProfile profile) :
+void inheritsRankProfile(ParsedRankProfile profile) :
{
String name;
}
{
<INHERITS> name = identifierWithDash() { profile.inherit(name); }
- ( <COMMA> name = identifierWithDash() { profile.inherit(name);; } )*
+ ( <COMMA> name = identifierWithDash() { profile.inherit(name); } )*
}
/**
@@ -2019,15 +2005,12 @@ void inheritsRankProfile(RankProfile profile) :
*
* @param profile The profile to modify.
*/
-void mutate(RankProfile profile) :
-{
-}
+void mutate(ParsedRankProfile profile) : { }
{
<MUTATE> lbrace() (mutate_operation(profile) <NL>)+ <RBRACE>
- { }
}
-void mutate_operation(RankProfile profile) :
+void mutate_operation(ParsedRankProfile profile) :
{
String attribute, operation;
RankProfile.MutateOperation.Phase phase;
@@ -2057,20 +2040,25 @@ String mutate_expr() :
*
* @param profile The profile to modify.
*/
-void function(RankProfile profile) :
+void function(ParsedRankProfile profile) :
{
String name, expression, parameter;
- List parameters = new ArrayList();
boolean inline = false;
+ ParsedRankFunction func;
}
{
( ( <FUNCTION> | <MACRO> ) inline = inline() name = identifier() [ "$" { name = name + token.image; } ]
"("
- [ parameter = identifier() { parameters.add(parameter); }
- ( <COMMA> parameter = identifier() { parameters.add(parameter); } )* ]
+ { func = new ParsedRankFunction(name); }
+ [ parameter = identifier() { func.addParameter(parameter); }
+ ( <COMMA> parameter = identifier() { func.addParameter(parameter); } )* ]
")"
lbrace() expression = expression() (<NL>)* <RBRACE> )
- { profile.addFunction(name, parameters, expression, inline); }
+ {
+ func.setExpression(expression);
+ func.setInline(inline);
+ profile.addFunction(func);
+ }
}
boolean inline() :
@@ -2086,7 +2074,7 @@ boolean inline() :
*
* @param profile The rank profile to modify.
*/
-void matchPhase(RankProfile profile) :
+void matchPhase(ParsedRankProfile profile) :
{
MatchPhaseSettings settings = new MatchPhaseSettings();
}
@@ -2094,7 +2082,7 @@ void matchPhase(RankProfile profile) :
<MATCHPHASE> lbrace() (matchPhaseItem(settings) (<NL>)*)* <RBRACE>
{
settings.checkValid();
- profile.setMatchPhaseSettings(settings);
+ profile.setMatchPhaseSettings(settings);
}
}
@@ -2159,7 +2147,7 @@ void diversityItem(DiversitySettings settings) :
*
* @param profile The rank profile to modify.
*/
-void firstPhase(RankProfile profile) :
+void firstPhase(ParsedRankProfile profile) :
{
String exp;
}
@@ -2167,16 +2155,16 @@ void firstPhase(RankProfile profile) :
<FIRSTPHASE> lbrace() (firstPhaseItem(profile) (<NL>)*)* <RBRACE>
}
-void firstPhaseItem(RankProfile profile) :
+void firstPhaseItem(ParsedRankProfile profile) :
{
- String expression;
- int rerankCount;
- double dropLimit;
+ String expression;
+ int keepRankCount;
+ double dropLimit;
}
{
- ( expression = expression() { profile.setFirstPhaseRanking(expression); }
- | (<KEEPRANKCOUNT> <COLON> rerankCount = integer()) { profile.setKeepRankCount(rerankCount); }
- | (<RANKSCOREDROPLIMIT> <COLON> dropLimit = consumeFloat()) { profile.setRankScoreDropLimit(dropLimit); }
+ ( expression = expression() { profile.setFirstPhaseRanking(expression); }
+ | (<KEEPRANKCOUNT> <COLON> keepRankCount = integer()) { profile.setKeepRankCount(keepRankCount); }
+ | (<RANKSCOREDROPLIMIT> <COLON> dropLimit = consumeFloat()) { profile.setRankScoreDropLimit(dropLimit); }
)
}
@@ -2185,7 +2173,7 @@ void firstPhaseItem(RankProfile profile) :
*
* @param profile The rank profile to modify.
*/
-void secondPhase(RankProfile profile) : { }
+void secondPhase(ParsedRankProfile profile) : { }
{
<SECONDPHASE> lbrace() (secondPhaseItem(profile) (<NL>)*)* <RBRACE>
}
@@ -2195,23 +2183,24 @@ void secondPhase(RankProfile profile) : { }
*
* @param profile The rank profile to modify.
*/
-void secondPhaseItem(RankProfile profile) :
+void secondPhaseItem(ParsedRankProfile profile) :
{
String expression;
int rerankCount;
}
{
- ( expression = expression() { profile.setSecondPhaseRanking(expression); }
- | (<RERANKCOUNT> <COLON> rerankCount = integer()) { profile.setRerankCount(rerankCount); }
+ ( expression = expression() { profile.setSecondPhaseRanking(expression); }
+ | (<RERANKCOUNT> <COLON> rerankCount = integer()) { profile.setRerankCount(rerankCount); }
)
}
+
/**
* This rule consumes a summary-features block of a rank profile.
*
* @param profile The rank profile to modify.
*/
-void summaryFeatures(RankProfile profile) :
+void summaryFeatures(ParsedRankProfile profile) :
{
String features;
String inherited = null;
@@ -2237,7 +2226,7 @@ void summaryFeatures(RankProfile profile) :
*
* @param profile The rank profile to modify.
*/
-void matchFeatures(RankProfile profile) :
+void matchFeatures(ParsedRankProfile profile) :
{
String features;
}
@@ -2258,7 +2247,7 @@ void matchFeatures(RankProfile profile) :
}
/** Consumes a rank-features block of a rank profile */
-void rankFeatures(RankProfile profile) :
+void rankFeatures(ParsedRankProfile profile) :
{
String features;
}
@@ -2276,7 +2265,7 @@ void rankFeatures(RankProfile profile) :
*
* @param profile The rank profile to modify.
*/
-void ignoreRankFeatures(RankProfile profile) : { }
+void ignoreRankFeatures(ParsedRankProfile profile) : { }
{
<IGNOREDEFAULTRANKFEATURES> { profile.setIgnoreDefaultRankFeatures(true); }
}
@@ -2286,7 +2275,7 @@ void ignoreRankFeatures(RankProfile profile) : { }
*
* @param profile The rank profile to modify.
*/
-void numThreadsPerSearch(RankProfile profile) :
+void numThreadsPerSearch(ParsedRankProfile profile) :
{
int num;
}
@@ -2299,7 +2288,7 @@ void numThreadsPerSearch(RankProfile profile) :
*
* @param profile The rank profile to modify.
*/
-void minHitsPerThread(RankProfile profile) :
+void minHitsPerThread(ParsedRankProfile profile) :
{
int num;
}
@@ -2312,7 +2301,7 @@ void minHitsPerThread(RankProfile profile) :
*
* @param profile the rank profile to modify
*/
-void numSearchPartitions(RankProfile profile) :
+void numSearchPartitions(ParsedRankProfile profile) :
{
int num;
}
@@ -2321,24 +2310,26 @@ void numSearchPartitions(RankProfile profile) :
}
/**
- * This rule consumes a num-threads-per-search statement for a rank profile.
+ * This rule consumes a termwise-limit statement for a rank profile.
*
* @param profile the rank profile to modify
*/
-void termwiseLimit(RankProfile profile) :
+void termwiseLimit(ParsedRankProfile profile) :
{
double num;
}
{
(<TERMWISELIMIT> <COLON> num = consumeFloat()) { profile.setTermwiseLimit(num); }
}
+
/**
- * This rule consumes a rank-properties block of a rank profile. There is a little trick within this rule to allow the
- * final rank property to skip the terminating newline token.
+ * This rule consumes a rank-properties block of a rank profile. There
+ * is a little trick within this rule to allow the final rank property
+ * to skip the terminating newline token.
*
* @param profile the rank profile to modify
*/
-void rankProperties(RankProfile profile) : { }
+void rankProperties(ParsedRankProfile profile) : { }
{
<RANKPROPERTIES> lbrace() (LOOKAHEAD(rankPropertyItem() <COLON> rankPropertyItem() <NL>)
rankProperty(profile) (<NL>)+)* [rankProperty(profile)] <RBRACE>
@@ -2349,7 +2340,7 @@ void rankProperties(RankProfile profile) : { }
*
* @param profile the rank profile to modify
*/
-void rankProperty(RankProfile profile) :
+void rankProperty(ParsedRankProfile profile) :
{
String key, val;
}
@@ -2358,7 +2349,6 @@ void rankProperty(RankProfile profile) :
{ profile.addRankProperty(key, val); }
}
-
/**
* This rule consumes a single rank property for a rank-properties block.
*
@@ -2380,14 +2370,14 @@ String rankPropertyItem() :
*
* @param profile The rank profile to modify.
*/
-void fieldWeight(RankProfile profile) :
+void fieldWeight(ParsedRankProfile profile) :
{
Integer num;
String name;
}
{
<WEIGHT> name = identifier() <COLON> num = integer()
- { profile.addRankSetting(name, RankProfile.RankSetting.Type.WEIGHT, num); }
+ { profile.addFieldRankWeight(name, num); }
}
/**
@@ -2395,14 +2385,14 @@ void fieldWeight(RankProfile profile) :
*
* @param profile The rank profile to modify.
*/
-void fieldRankType(RankProfile profile) :
+void fieldRankType(ParsedRankProfile profile) :
{
String name;
String type;
}
{
<RANKTYPE> name = identifier() <COLON> type = identifier()
- { profile.addRankSetting(name, RankProfile.RankSetting.Type.RANKTYPE, RankType.fromString(type)); }
+ { profile.addFieldRankType(name, type); }
}
/**
@@ -2410,13 +2400,13 @@ void fieldRankType(RankProfile profile) :
*
* @param profile The rank profile to modify.
*/
-void fieldRankFilter(RankProfile profile) :
+void fieldRankFilter(ParsedRankProfile profile) :
{
String name;
}
{
<RANK> name = identifier() <COLON> <FILTER>
- { profile.addRankSetting(name, RankProfile.RankSetting.Type.PREFERBITVECTOR, Boolean.TRUE); }
+ { profile.addFieldRankFilter(name, true); }
}
/**
@@ -2472,10 +2462,8 @@ void rankDegradationItem() :
/**
* This rule consumes a rank-degradation statement of a rank profile.
- *
- * @param profile The rank profile to modify.
*/
-void rankDegradation(RankProfile profile) :
+void rankDegradation() :
{
double freq;
}
@@ -2489,7 +2477,7 @@ void rankDegradation(RankProfile profile) :
/**
* Consumes a set of constants available in ranking expressions in the enclosing profile.
*/
-void constants(RankProfile profile) :
+void constants(ParsedRankProfile profile) :
{
String name;
}
@@ -2500,7 +2488,7 @@ void constants(RankProfile profile) :
<RBRACE>
}
-void constantValue(RankProfile profile, String name) :
+void constantValue(ParsedRankProfile profile, String name) :
{
String value;
}
@@ -2508,7 +2496,7 @@ void constantValue(RankProfile profile, String name) :
<COLON> value = identifier() { profile.addConstant(name, Value.parse(value)); }
}
-void constantTensor(RankProfile profile, String name) :
+void constantTensor(ParsedRankProfile profile, String name) :
{
String tensorString = "";
TensorType tensorType = null;
diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj
index 38622cbbcdc..5da20acf486 100644
--- a/config-model/src/main/javacc/SDParser.jj
+++ b/config-model/src/main/javacc/SDParser.jj
@@ -2,6 +2,10 @@
// Schema parser.
//
+// NOTE: A full rewrite of parsing is in progress; avoid changing this
+// file if possible, coordinate with IntermediateParser.jj if you must
+// change something.
+//
// NOTE: When this is changed, also change integration/intellij/src/main/bnf/ai/vespa/intellij/schema/parser/sd.bnf
options {
@@ -1410,7 +1414,7 @@ void summaryProperty(SummaryInFieldLongOperation field) :
}
{
name = identifierWithDash() <COLON> (value = identifierWithDash() | value = quotedString())
- { field.addProperty(new SummaryField.Property(name, value)); }
+ { deployLogger.logApplicationPackage(Level.WARNING, "Specifying summary properties is deprecated and has no effect."); }
}
/**