diff --git a/vitrivr-engine-query/src/main/kotlin/org/vitrivr/engine/query/model/api/input/InputData.kt b/vitrivr-engine-query/src/main/kotlin/org/vitrivr/engine/query/model/api/input/InputData.kt index d149b197..342f9625 100644 --- a/vitrivr-engine-query/src/main/kotlin/org/vitrivr/engine/query/model/api/input/InputData.kt +++ b/vitrivr-engine-query/src/main/kotlin/org/vitrivr/engine/query/model/api/input/InputData.kt @@ -104,7 +104,7 @@ data class RetrievableIdInputData(val id: String, override val comparison: Strin * Cannot be converted to a [ContentElement] */ @Serializable -data class BooleanInputData(val value: Boolean, override val comparison: String? = "=="): InputData(){ +data class BooleanInputData(val data: Boolean, override val comparison: String? = "=="): InputData(){ override val type = InputType.BOOLEAN override fun toContent(): ContentElement<*> { throw UnsupportedOperationException("Cannot derive content from BooleanInputData") @@ -116,7 +116,7 @@ data class BooleanInputData(val value: Boolean, override val comparison: String? * Cannot be converted to a [ContentElement] */ @Serializable -data class NumericInputData(val value: Double, override val comparison: String? = "==") : InputData(){ +data class NumericInputData(val data: Double, override val comparison: String? = "==") : InputData(){ override val type = InputType.NUMERIC override fun toContent(): ContentElement<*> { throw UnsupportedOperationException("Cannot derive content from NumericInputData") @@ -128,7 +128,7 @@ data class NumericInputData(val value: Double, override val comparison: String? * Cannot be converted to a [ContentElement] */ @Serializable -data class DateInputData(val value: String, override val comparison: String? = "==") : InputData() { +data class DateInputData(val data: String, override val comparison: String? = "==") : InputData() { override val type = InputType.DATE override fun toContent(): ContentElement<*> {throw UnsupportedOperationException("Cannot derive content from DateInputData")} @@ -137,6 +137,6 @@ data class DateInputData(val value: String, override val comparison: String? = " */ fun parseDate():Date{ val formatter = SimpleDateFormat("YYYY-mm-dd", Locale.ENGLISH) - return formatter.parse(value) + return formatter.parse(data) } } diff --git a/vitrivr-engine-query/src/main/kotlin/org/vitrivr/engine/query/parsing/QueryParser.kt b/vitrivr-engine-query/src/main/kotlin/org/vitrivr/engine/query/parsing/QueryParser.kt index 4423327c..828dc844 100644 --- a/vitrivr-engine-query/src/main/kotlin/org/vitrivr/engine/query/parsing/QueryParser.kt +++ b/vitrivr-engine-query/src/main/kotlin/org/vitrivr/engine/query/parsing/QueryParser.kt @@ -106,16 +106,16 @@ class QueryParser(val schema: Schema) { } is BooleanInputData -> { require(subfield.type == Type.BOOLEAN){"The given sub-field ${fieldAndAttributeName.first}.${fieldAndAttributeName.second}'s type is ${subfield.type}, which is not the expexted ${Type.BOOLEAN}"} - Value.Boolean(input.value) + Value.Boolean(input.data) } is NumericInputData -> { when(subfield.type){ - Type.DOUBLE -> Value.Double(input.value) - Type.INT -> Value.Int(input.value.toInt()) - Type.LONG -> Value.Long(input.value.toLong()) - Type.SHORT -> Value.Short(input.value.toInt().toShort()) - Type.BYTE -> Value.Byte(input.value.toInt().toByte()) - Type.FLOAT -> Value.Float(input.value.toFloat()) + Type.DOUBLE -> Value.Double(input.data) + Type.INT -> Value.Int(input.data.toInt()) + Type.LONG -> Value.Long(input.data.toLong()) + Type.SHORT -> Value.Short(input.data.toInt().toShort()) + Type.BYTE -> Value.Byte(input.data.toInt().toByte()) + Type.FLOAT -> Value.Float(input.data.toFloat()) else -> throw IllegalArgumentException("Cannot work with NumericInputData $input but non-numerical sub-field $subfield") } }