aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2023-03-17 14:12:49 +0100
committerTor Egge <Tor.Egge@online.no>2023-03-17 14:12:49 +0100
commitffa4643f9bae077efdf35b3dc12ce337f68caeb5 (patch)
tree5292a027ea7821f6d528a5d8dfb6a3b1f1d4e8f5 /config-model/src/main/java/com/yahoo
parent0ee0a814b61bb356a8ee526189bcdb57cda003f2 (diff)
Add raw attributes to config model.
Diffstat (limited to 'config-model/src/main/java/com/yahoo')
-rw-r--r--config-model/src/main/java/com/yahoo/schema/document/Attribute.java6
-rw-r--r--config-model/src/main/java/com/yahoo/schema/processing/Processing.java2
-rw-r--r--config-model/src/main/java/com/yahoo/schema/processing/SingleValueOnlyAttributeValidator.java (renamed from config-model/src/main/java/com/yahoo/schema/processing/BoolAttributeValidator.java)9
3 files changed, 10 insertions, 7 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/document/Attribute.java b/config-model/src/main/java/com/yahoo/schema/document/Attribute.java
index 34e86cbf4a8..70fcf64dff3 100644
--- a/config-model/src/main/java/com/yahoo/schema/document/Attribute.java
+++ b/config-model/src/main/java/com/yahoo/schema/document/Attribute.java
@@ -100,7 +100,8 @@ public final class Attribute implements Cloneable, Serializable {
BOOL("bool", "BOOL"),
PREDICATE("predicate", "PREDICATE"),
TENSOR("tensor", "TENSOR"),
- REFERENCE("reference", "REFERENCE");
+ REFERENCE("reference", "REFERENCE"),
+ RAW("raw", "RAW");
private final String myName; // different from what name() returns.
private final String exportAttributeTypeName;
@@ -290,7 +291,7 @@ public final class Attribute implements Cloneable, Serializable {
} else if (fval instanceof ByteFieldValue) {
return Type.BYTE;
} else if (fval instanceof Raw) {
- return Type.BYTE;
+ return Type.RAW;
} else if (fval instanceof PredicateFieldValue) {
return Type.PREDICATE;
} else if (fval instanceof TensorFieldValue) {
@@ -344,6 +345,7 @@ public final class Attribute implements Cloneable, Serializable {
case PREDICATE -> DataType.PREDICATE;
case TENSOR -> DataType.getTensor(tensorType.orElseThrow(IllegalStateException::new));
case REFERENCE-> createReferenceDataType();
+ case RAW -> DataType.RAW;
default -> throw new IllegalArgumentException("Unknown attribute type " + attributeType);
};
}
diff --git a/config-model/src/main/java/com/yahoo/schema/processing/Processing.java b/config-model/src/main/java/com/yahoo/schema/processing/Processing.java
index 8f7e8daeed0..df4b0d0d941 100644
--- a/config-model/src/main/java/com/yahoo/schema/processing/Processing.java
+++ b/config-model/src/main/java/com/yahoo/schema/processing/Processing.java
@@ -89,7 +89,7 @@ public class Processing {
OnnxModelConfigGenerator::new,
OnnxModelTypeResolver::new,
RankingExpressionTypeResolver::new,
- BoolAttributeValidator::new,
+ SingleValueOnlyAttributeValidator::new,
PagedAttributeValidator::new,
// These should be last:
IndexingValidation::new,
diff --git a/config-model/src/main/java/com/yahoo/schema/processing/BoolAttributeValidator.java b/config-model/src/main/java/com/yahoo/schema/processing/SingleValueOnlyAttributeValidator.java
index bdb1eed4b10..b2786e6c785 100644
--- a/config-model/src/main/java/com/yahoo/schema/processing/BoolAttributeValidator.java
+++ b/config-model/src/main/java/com/yahoo/schema/processing/SingleValueOnlyAttributeValidator.java
@@ -14,9 +14,9 @@ import com.yahoo.vespa.model.container.search.QueryProfiles;
*
* @author geirst
*/
-public class BoolAttributeValidator extends Processor {
+public class SingleValueOnlyAttributeValidator extends Processor {
- public BoolAttributeValidator(Schema schema, DeployLogger deployLogger, RankProfileRegistry rankProfileRegistry, QueryProfiles queryProfiles) {
+ public SingleValueOnlyAttributeValidator(Schema schema, DeployLogger deployLogger, RankProfileRegistry rankProfileRegistry, QueryProfiles queryProfiles) {
super(schema, deployLogger, rankProfileRegistry, queryProfiles);
}
@@ -27,9 +27,10 @@ public class BoolAttributeValidator extends Processor {
if (attribute == null) {
continue;
}
- if (attribute.getType().equals(Attribute.Type.BOOL) &&
+ if ((attribute.getType().equals(Attribute.Type.BOOL) ||
+ attribute.getType().equals(Attribute.Type.RAW)) &&
!attribute.getCollectionType().equals(Attribute.CollectionType.SINGLE)) {
- fail(schema, field, "Only single value bool attribute fields are supported");
+ fail(schema, field, "Only single value " + attribute.getType().getName() + " attribute fields are supported");
}
}
}