Skip to content

Conversation

@bevzzz
Copy link
Collaborator

@bevzzz bevzzz commented Nov 25, 2025

This PR replaces Read-/WriteWeaviateObject with a unified WeaviateObject type, effectively reversing #503.

After some discussion it is clear that reference properties are the key difference between the read- / write- objects and that the user needn't be aware of that unless they're working with reference properties.

Inserting data

c.data.insert(WeaviateObject.of(properties, obj -> obj.vectors(Vectors.of(...))));

Metadata fields are now split into those always present (uuid, vectors, timestamps, tenants) and those related to queries (see QueryMetadata).

Querying data

List<WeaviateObject<?>> objects = c.query.nearVector(new float[]{1, 2, 3}).objects();

var first = objects.get(0);
first.uuid();
first.vectors();
first.createdAt();

// Query metadata
first.queryMetadata().distance();

Traversing references

A helper .asWeaviateObject() allows users to cast references into WeaviateObjects for an easier traversal

var searchResult = c.query.fetchObjects(q -> q.returnReferences(
  QueryReference.single("friendsWith", ref -> ref.returnProperties("birthday"))
));

searchResult.objects().forEach(object -> {
  object.references().forEach((propertyName, ref) -> {
    // Values that are always available
    ref.uuid();
    ref.collection();
    
    // Getting properties of the reference object requires type-casting
    ref.asWeaviateObject().properties().get("birthday");
  });
});

Copy link

@orca-security-eu orca-security-eu bot left a comment

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

@bevzzz bevzzz marked this pull request as ready for review November 25, 2025 16:41
cross-tenant references are not supported on the server
Some integration tests failed w/ a BufferUnderflow exception
when run against v1.32.16, which we can handle more gracefully
by returning null from decodeUuid().

An invalid UUID is a server-side issue and we should not try to
decode it in the client.
@bevzzz bevzzz merged commit ecdb537 into v6 Nov 25, 2025
6 checks passed
@bevzzz bevzzz deleted the v6-single-weaviate-object branch November 25, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants