summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorArne H Juul <arnej27959@users.noreply.github.com>2022-04-06 20:46:54 +0200
committerGitHub <noreply@github.com>2022-04-06 20:46:54 +0200
commitf92bc8abaf011a2540a19a64997a3f1d920ad07f (patch)
tree179d3c472bd279850abf23f247753ae999abddb8 /config-model
parentcf3f7bbb9e99f5b3e6cf3ac3f93e813042e4a12c (diff)
parent04ec819f7891737b64dd88c85044392d5fc85284 (diff)
Merge pull request #22003 from vespa-engine/arnej/rank-filter-in-struct-field
Arnej/rank filter in struct field
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java2
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java15
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertParsedFields.java18
-rw-r--r--config-model/src/main/javacc/IntermediateParser.jj1
-rw-r--r--config-model/src/test/derived/structandfieldset/attributes.cfg96
-rw-r--r--config-model/src/test/derived/structandfieldset/test.sd5
6 files changed, 121 insertions, 16 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
index cb1e2e047ad..8366dde383b 100644
--- a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
+++ b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
@@ -81,7 +81,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea
private boolean useV8GeoPositions = false;
private List<String> environmentVariables = List.of();
private boolean avoidRenamingSummaryFeatures = false;
- private boolean experimentalSdParsing = false;
+ private boolean experimentalSdParsing = true;
private Architecture adminClusterNodeResourcesArchitecture = Architecture.getDefault();
@Override public ModelContext.FeatureFlags featureFlags() { return this; }
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java
index dad8385e0e1..7acf5557236 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/AttributeFields.java
@@ -100,17 +100,21 @@ public class AttributeFields extends Derived implements AttributesConfig.Produce
}
}
+ private void applyRanking(ImmutableSDField field, Attribute attribute) {
+ Ranking ranking = field.getRanking();
+ if (ranking != null && ranking.isFilter()) {
+ attribute.setEnableBitVectors(true);
+ attribute.setEnableOnlyBitVector(true);
+ }
+ }
+
private void deriveAttribute(ImmutableSDField field, Attribute fieldAttribute) {
Attribute attribute = getAttribute(fieldAttribute.getName());
if (attribute == null) {
attributes.put(fieldAttribute.getName(), fieldAttribute);
attribute = getAttribute(fieldAttribute.getName());
}
- Ranking ranking = field.getRanking();
- if (ranking != null && ranking.isFilter()) {
- attribute.setEnableBitVectors(true);
- attribute.setEnableOnlyBitVector(true);
- }
+ applyRanking(field, attribute);
}
private void deriveImportedAttributes(ImmutableSDField field) {
@@ -134,6 +138,7 @@ public class AttributeFields extends Derived implements AttributesConfig.Produce
}
Attribute attribute = field.getAttributes().get(field.getName());
if (attribute != null) {
+ applyRanking(field, attribute);
attributes.put(attribute.getName(), attribute.convertToArray());
}
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertParsedFields.java b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertParsedFields.java
index dee9b648228..92e099bc1fe 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertParsedFields.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ConvertParsedFields.java
@@ -159,6 +159,15 @@ public class ConvertParsedFields {
for (var structField : parsed.getStructFields()) {
convertStructField(field, structField);
}
+ if (parsed.hasLiteral()) {
+ field.getRanking().setLiteral(true);
+ }
+ if (parsed.hasFilter()) {
+ field.getRanking().setFilter(true);
+ }
+ if (parsed.hasNormal()) {
+ field.getRanking().setNormal(true);
+ }
}
private void convertStructField(SDField field, ParsedField parsed) {
@@ -196,15 +205,6 @@ public class ConvertParsedFields {
summaryField.addDestination("default");
summaryField.setTransform(summaryField.getTransform().bold());
}
- if (parsed.hasLiteral()) {
- field.getRanking().setLiteral(true);
- }
- if (parsed.hasFilter()) {
- field.getRanking().setFilter(true);
- }
- if (parsed.hasNormal()) {
- field.getRanking().setNormal(true);
- }
}
static void convertSummaryFieldSettings(SummaryField summary, ParsedSummaryField parsed) {
diff --git a/config-model/src/main/javacc/IntermediateParser.jj b/config-model/src/main/javacc/IntermediateParser.jj
index 6119eb5e2ce..4815aba0903 100644
--- a/config-model/src/main/javacc/IntermediateParser.jj
+++ b/config-model/src/main/javacc/IntermediateParser.jj
@@ -935,6 +935,7 @@ void structFieldBody(ParsedField field) : { }
attribute(field) |
matchSettings(field.matchSettings()) |
queryCommand(field) |
+ rank(field) |
structField(field) |
summaryTo(field) )
}
diff --git a/config-model/src/test/derived/structandfieldset/attributes.cfg b/config-model/src/test/derived/structandfieldset/attributes.cfg
new file mode 100644
index 00000000000..b441857c9c7
--- /dev/null
+++ b/config-model/src/test/derived/structandfieldset/attributes.cfg
@@ -0,0 +1,96 @@
+attribute[].name "tag"
+attribute[].datatype STRING
+attribute[].collectiontype SINGLE
+attribute[].dictionary.type BTREE
+attribute[].dictionary.match UNCASED
+attribute[].match UNCASED
+attribute[].removeifzero false
+attribute[].createifnonexistent false
+attribute[].fastsearch false
+attribute[].huge false
+attribute[].paged false
+attribute[].ismutable false
+attribute[].sortascending true
+attribute[].sortfunction UCA
+attribute[].sortstrength PRIMARY
+attribute[].sortlocale ""
+attribute[].enablebitvectors false
+attribute[].enableonlybitvector false
+attribute[].fastaccess false
+attribute[].arity 8
+attribute[].lowerbound -9223372036854775808
+attribute[].upperbound 9223372036854775807
+attribute[].densepostinglistthreshold 0.4
+attribute[].tensortype ""
+attribute[].imported false
+attribute[].maxuncommittedmemory 77777
+attribute[].distancemetric EUCLIDEAN
+attribute[].index.hnsw.enabled false
+attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.neighborstoexploreatinsert 200
+attribute[].index.hnsw.distancemetric EUCLIDEAN
+attribute[].index.hnsw.multithreadedindexing true
+attribute[].name "people.first_name"
+attribute[].datatype STRING
+attribute[].collectiontype ARRAY
+attribute[].dictionary.type BTREE
+attribute[].dictionary.match UNCASED
+attribute[].match UNCASED
+attribute[].removeifzero false
+attribute[].createifnonexistent false
+attribute[].fastsearch false
+attribute[].huge false
+attribute[].paged false
+attribute[].ismutable false
+attribute[].sortascending true
+attribute[].sortfunction UCA
+attribute[].sortstrength PRIMARY
+attribute[].sortlocale ""
+attribute[].enablebitvectors false
+attribute[].enableonlybitvector false
+attribute[].fastaccess false
+attribute[].arity 8
+attribute[].lowerbound -9223372036854775808
+attribute[].upperbound 9223372036854775807
+attribute[].densepostinglistthreshold 0.4
+attribute[].tensortype ""
+attribute[].imported false
+attribute[].maxuncommittedmemory 77777
+attribute[].distancemetric EUCLIDEAN
+attribute[].index.hnsw.enabled false
+attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.neighborstoexploreatinsert 200
+attribute[].index.hnsw.distancemetric EUCLIDEAN
+attribute[].index.hnsw.multithreadedindexing true
+attribute[].name "people.last_name"
+attribute[].datatype STRING
+attribute[].collectiontype ARRAY
+attribute[].dictionary.type BTREE
+attribute[].dictionary.match UNCASED
+attribute[].match UNCASED
+attribute[].removeifzero false
+attribute[].createifnonexistent false
+attribute[].fastsearch false
+attribute[].huge false
+attribute[].paged false
+attribute[].ismutable false
+attribute[].sortascending true
+attribute[].sortfunction UCA
+attribute[].sortstrength PRIMARY
+attribute[].sortlocale ""
+attribute[].enablebitvectors true
+attribute[].enableonlybitvector true
+attribute[].fastaccess false
+attribute[].arity 8
+attribute[].lowerbound -9223372036854775808
+attribute[].upperbound 9223372036854775807
+attribute[].densepostinglistthreshold 0.4
+attribute[].tensortype ""
+attribute[].imported false
+attribute[].maxuncommittedmemory 77777
+attribute[].distancemetric EUCLIDEAN
+attribute[].index.hnsw.enabled false
+attribute[].index.hnsw.maxlinkspernode 16
+attribute[].index.hnsw.neighborstoexploreatinsert 200
+attribute[].index.hnsw.distancemetric EUCLIDEAN
+attribute[].index.hnsw.multithreadedindexing true
diff --git a/config-model/src/test/derived/structandfieldset/test.sd b/config-model/src/test/derived/structandfieldset/test.sd
index 77316eab9c9..da12787e564 100644
--- a/config-model/src/test/derived/structandfieldset/test.sd
+++ b/config-model/src/test/derived/structandfieldset/test.sd
@@ -14,7 +14,10 @@ schema test {
field people type array<person> {
indexing: summary
struct-field first_name { indexing: attribute }
- struct-field last_name { indexing: attribute }
+ struct-field last_name {
+ indexing: attribute
+ rank: filter
+ }
}
}