Skip to content

Commit c2b2e8c

Browse files
committed
Handy fun 'getMetadata(key: String)' introduce for Match data holder.
1 parent a122ba1 commit c2b2e8c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pinecone-core/src/main/scala/io/cequence/pineconescala/domain/response/QueryResponse.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ case class QueryResponse(
1212
case class Match(
1313
id: String,
1414
score: Double,
15-
values: Seq[Double], // not returned when includeValues = false
15+
values: Seq[Double], // not returned when includeValues = false
1616
sparseValues: Option[SparseVector],
17-
metadata: Option[Map[String, String]] // not returned when includeMetadata = true
18-
)
17+
metadata: Option[Map[String, String]] // not returned when includeMetadata = false
18+
) {
19+
val metadataUnwrapped : Map[String, String] = metadata.getOrElse(Map[String, String]())
20+
def getMetadata(key: String): Option[String] = metadataUnwrapped.get(key)
21+
}

0 commit comments

Comments
 (0)