Skip to content
Closed
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!document.isText()) {
    throw new IllegalArgumentException("""
            QdrantVectorStore supports only text-based Document for now –
            received media-only Document; see issue #3609.
            """);
}

var payload = QdrantValueFactory.toValueMap(document.getMetadata());
payload.put(CONTENT_FIELD_NAME, io.qdrant.client.ValueFactory.value(document.getText()));
return payload;

How about this code?

It can prevent unnecessary execution of QdrantValueFactory.toValueMap.
And it's more intuitive.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!document.isText()) {
    throw new IllegalArgumentException("""
            QdrantVectorStore supports only text-based Document for now –
            received media-only Document; see issue #3609.
            """);
}

var payload = QdrantValueFactory.toValueMap(document.getMetadata());
payload.put(CONTENT_FIELD_NAME, io.qdrant.client.ValueFactory.value(document.getText()));
return payload;

How about this code?

It can prevent unnecessary execution of QdrantValueFactory.toValueMap. And it's more intuitive.

Thanks for the suggestion-updated!

Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,13 @@ private Document toDocument(ScoredPoint point) {
*/
private Map<String, Value> toPayload(Document document) {
try {
if(!document.isText()) {
throw new IllegalArgumentException("""
QdrantVectorStore supports only text-based Document for now –
received media-only Document; see issue #3609.
""");
}

var payload = QdrantValueFactory.toValueMap(document.getMetadata());
payload.put(CONTENT_FIELD_NAME, io.qdrant.client.ValueFactory.value(document.getText()));
return payload;
Expand Down