Hack: fold to lower for repository_main_uri to hide the case insenitivity scheduled to be removed

parent 6a2bb627
Pipeline #40962 failed with stages
in 50 minutes and 16 seconds
......@@ -277,16 +277,27 @@ class ConnectorElasticSearch protected[elasticsearch] (val metaInfo: MetaInfoEnv
private def transformOpEqualTerm(field: String, quantifier: QueryQuantifier,
values: Seq[jn.JValue#Values]): Either[jsonapi.Error, QueryDefinition] = {
import ConnectorElasticSearch.countFieldName
def maybeLower(value: jn.JValue#Values): jn.JValue#Values = {
if (field == "section_repository_info.main_file_uri") {
value match {
case s: String => (jn.JString(s.toLowerCase()): jn.JValue).values
case v => v
}
} else {
value
}
}
quantifier match {
case QueryQuantifier.AllTarget =>
values.size match {
case 1 => Right(TermQueryDefinition(field, values.head))
case 1 => Right(TermQueryDefinition(field, maybeLower(values.head)))
case _ => Right(BoolQueryDefinition(
must = values.map(value => TermQueryDefinition(field, value))
must = values.map(value => TermQueryDefinition(field, maybeLower(value)))
))
}
case QueryQuantifier.All => Right(BoolQueryDefinition(must =
values.map { value => TermQueryDefinition(field, value) } :+
values.map { value => TermQueryDefinition(field, maybeLower(value)) } :+
TermQueryDefinition(countFieldName(field), values.length)))
case QueryQuantifier.Any =>
values.size match {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment