Skip to content

Commit 90217dc

Browse files
committed
Fix filter tag escaping
1 parent 2fba5e6 commit 90217dc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/commonMain/kotlin/com/algolia/search/model/filter/Filter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public sealed class Filter {
9090
public constructor(
9191
value: String,
9292
isNegated: Boolean = false
93-
) : this(Attribute("_tags"), isNegated, value.escape())
93+
) : this(Attribute("_tags"), isNegated, value)
9494

9595
/**
9696
* Operator to negates a [Filter.Tag].

src/commonMain/kotlin/com/algolia/search/model/filter/FilterInternals.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal fun Filter.Facet.toSQL(): String {
2525
}
2626

2727
internal fun Filter.Tag.toSQL(): String {
28-
val expression = "$attribute:$value"
28+
val expression = "$attribute:${value.escape()}"
2929

3030
return if (isNegated) "NOT $expression" else expression
3131
}
@@ -99,7 +99,7 @@ internal fun Filter.Facet.toLegacy(): List<String> {
9999
}
100100

101101
internal fun Filter.Tag.toLegacy(): List<String> {
102-
val value = if (isNegated) "-$value" else value
102+
val value = if (isNegated) "-${value.escape()}" else value.escape()
103103

104104
return listOf("$attribute:$value")
105105
}

0 commit comments

Comments
 (0)