From 539aa59053c0156c94c39259d21f3dbceedd5032 Mon Sep 17 00:00:00 2001 From: Luca Rossetto Date: Tue, 30 Jul 2024 18:27:05 +0200 Subject: [PATCH] Fixed struct descriptor deserialization --- .../engine/core/model/query/basics/ComparisonOperator.kt | 2 +- .../engine/database/jsonl/scalar/ScalarJsonlReader.kt | 2 +- .../engine/database/jsonl/struct/StructJsonlReader.kt | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/query/basics/ComparisonOperator.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/query/basics/ComparisonOperator.kt index 9016a4af..362236ae 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/query/basics/ComparisonOperator.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/query/basics/ComparisonOperator.kt @@ -112,7 +112,7 @@ enum class ComparisonOperator(val value: String) { when (v1) { is Value.String, is Value.Text -> { - (v1.value as String).replace("*", "\\*").replace("%", "*").toRegex().matches(v2.value as String) + (v1.value as String).replace("\\", "\\\\").replace("*", "\\*").replace("%", "*").toRegex().matches(v2.value as String) } else -> false diff --git a/vitrivr-engine-module-jsonl/src/main/kotlin/org/vitrivr/engine/database/jsonl/scalar/ScalarJsonlReader.kt b/vitrivr-engine-module-jsonl/src/main/kotlin/org/vitrivr/engine/database/jsonl/scalar/ScalarJsonlReader.kt index 67424bbe..272096b1 100644 --- a/vitrivr-engine-module-jsonl/src/main/kotlin/org/vitrivr/engine/database/jsonl/scalar/ScalarJsonlReader.kt +++ b/vitrivr-engine-module-jsonl/src/main/kotlin/org/vitrivr/engine/database/jsonl/scalar/ScalarJsonlReader.kt @@ -51,6 +51,6 @@ class ScalarJsonlReader( private fun queryBoolean(query: SimpleBooleanQuery<*>): Sequence> = getAll().filter { descriptor -> - query.comparison.compare(query.value, descriptor.value) + query.comparison.compare(descriptor.value, query.value) } } diff --git a/vitrivr-engine-module-jsonl/src/main/kotlin/org/vitrivr/engine/database/jsonl/struct/StructJsonlReader.kt b/vitrivr-engine-module-jsonl/src/main/kotlin/org/vitrivr/engine/database/jsonl/struct/StructJsonlReader.kt index bbbf1aa4..1876e5b8 100644 --- a/vitrivr-engine-module-jsonl/src/main/kotlin/org/vitrivr/engine/database/jsonl/struct/StructJsonlReader.kt +++ b/vitrivr-engine-module-jsonl/src/main/kotlin/org/vitrivr/engine/database/jsonl/struct/StructJsonlReader.kt @@ -31,8 +31,8 @@ class StructJsonlReader( val parameters: MutableList = mutableListOf( descriptorId, retrievableId, - prototype.layout(), - valueMap + valueMap, + this.field ) prototype.layout().forEach { attribute -> @@ -54,7 +54,7 @@ class StructJsonlReader( } private fun queryBoolean(query: SimpleBooleanQuery<*>): Sequence = getAll().filter { descriptor -> - query.comparison.compare(query.value, descriptor.values()[query.attributeName!!]!!) + query.comparison.compare(descriptor.values()[query.attributeName!!]!!, query.value) }