from weaviate.classes.query import MetadataQuery
for object in collection.query.near_text("example a", return_metadata=MetadataQuery(distance=True)).objects:
print(object)
print(object.metadata.distance)
I will not get the 0 distance for a.
If you search using nearObject, or nearVector, then you can get it:
from weaviate.classes.query import MetadataQuery
for object in collection.query.near_object(near_object=generate_uuid5("example a"), return_metadata=MetadataQuery(distance=True)).objects:
print(object.properties)
print(object.metadata.distance)