This commit is contained in:
Anzori (Nika) Ghurtchumelia 2023-04-04 21:09:49 -05:00 committed by GitHub
commit f1b3792445
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,10 +44,7 @@ private[hnsw] object JMapBasedIdEmbeddingMap {
injection: Injection[T, Array[Byte]],
numElements: Option[Int] = Option.empty
): IdEmbeddingMap[T] = {
val map = numElements match {
case Some(elements) => new ConcurrentHashMap[T, EmbeddingVector](elements)
case None => new ConcurrentHashMap[T, EmbeddingVector]()
}
val map = numElements.fold(new ConcurrentHashMap[T, EmbeddingVector])(elems => new ConcurrentHashMap(elems))
HnswIOUtil.loadEmbeddings(
embeddingFile,
injection,