Skip to content

Commit 3e058a2

Browse files
max-zillalmarini
andauthored
Change how nested objects are indexed (#404)
* modifications to indexing * remove old comment * Update CHANGELOG.md --------- Co-authored-by: Luigi Marini <[email protected]>
1 parent e57bf56 commit 3e058a2

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ registration or heartbeat to Clowder that will restrict use of that extractor to
2424
## Fixed
2525
- Updated lastModifiesDate when updating file or metadata to a dataset, added lastModified to UI [386](https://github.com/clowder-framework/clowder/issues/386)
2626
- Disabled button while create dataset ajax call is still going on [#311](https://github.com/clowder-framework/clowder/issues/311)
27+
- Fixed bug where complex JSON metadata objects using arrays were not being indexed properly for search.
2728

2829

2930
## 1.21.0 - 2022-08-23

app/services/ElasticsearchPlugin.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ class ElasticsearchPlugin(application: Application) extends Plugin {
527527
case jv: JsArray => {
528528
builder.startArray(clean_k)
529529
jv.value.foreach(subv => {
530-
builder.value(subv.toString.replace("\"",""))
530+
builder.value(convertJsObjectToBuilder(builder, subv.asInstanceOf[JsObject]))
531531
})
532532
builder.endArray()
533533
}
@@ -598,11 +598,9 @@ class ElasticsearchPlugin(application: Application) extends Plugin {
598598
// Elasticsearch 2 does not allow periods in field names
599599
builder.startArray(k.toString.replace(".", "_"))
600600
v.value.foreach(jv => {
601-
// Try to interpret numeric value from each String if possible
602-
parseDouble(jv.toString) match {
603-
case Some(d) => builder.value(d)
604-
case None => builder.value(jv)
605-
}
601+
builder.startObject()
602+
convertJsObjectToBuilder(builder, jv.asInstanceOf[JsObject])
603+
builder.endObject()
606604
})
607605
builder.endArray()
608606
}

0 commit comments

Comments
 (0)