Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* Utility methods for building io.qdrant.client.grpc.JsonWithInt.Value from Java objects.
*
* @author Anush Shetty
* @author Ilayaperumal Gopinathan
* @since 0.8.1
*/
final class QdrantValueFactory {
Expand Down Expand Up @@ -65,6 +66,10 @@ private static Value value(Object value) {
return value((Map<String, Object>) value);
}

if (value instanceof List) {
return value((List<Object>) value);
}

switch (value.getClass().getSimpleName()) {
case "String":
return ValueFactory.value((String) value);
Expand All @@ -81,6 +86,16 @@ private static Value value(Object value) {
}
}

private static Value value(List<Object> elements) {
List<Value> values = new ArrayList<Value>(elements.size());

for (Object element : elements) {
values.add(value(element));
}

return ValueFactory.list(values);
}

private static Value value(Object[] elements) {
List<Value> values = new ArrayList<Value>(elements.length);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ public class QdrantVectorStoreIT extends BaseVectorStoreTests {
List<Document> documents = List.of(
new Document("Spring AI rocks!! Spring AI rocks!! Spring AI rocks!! Spring AI rocks!! Spring AI rocks!!",
Collections.singletonMap("meta1", "meta1")),
new Document("Hello World Hello World Hello World Hello World Hello World Hello World Hello World"),
new Document("Hello World Hello World Hello World Hello World Hello World Hello World Hello World",
Collections.singletonMap("meta1", List.of("meta-list"))),
new Document(
"Great Depression Great Depression Great Depression Great Depression Great Depression Great Depression",
Collections.singletonMap("meta2", "meta2")));
Collections.singletonMap("meta2", List.of("meta-list"))));

@BeforeAll
static void setup() throws InterruptedException, ExecutionException {
Expand Down