Skip to content

Conversation

bevzzz
Copy link
Collaborator

@bevzzz bevzzz commented Jun 24, 2025

This PR adds support for NearObject, Near, and Hybrid operators in query and aggregate namespaces.

final var things = client.collections.use("Things");

things.query.hybrid("something like that", q -> q.alpha(0.3f).fusionType(Hybrid.FusionType.RANKED));

// .excludeSelf is a shorthand for `where(Where.uuid().ne("this-thing-id"))`
things.query.nearObject("this-thing-id", q -> q.excludeSelf());

There's also some minor improvements to Where-filter builders:

  • Where.uuid() is a shorthand for Where.property("_id")
  • Where::toString now prints human-readable representation of the filter
Where.reference("hasFriend", "name").eq("Piglet")`
// Outputs:
//   "Where(hasFriend::name Equal Piglet)"
  • Calls to .where(...) can now be chained -- individual conditions will be AND'ed together
query -> query.where(Where.and(
  Where.property("name").eq("pooh"),
  Where.property("age").gte(22)
))

// is equivalent to

query -> query
  .where(Where.property("name").eq("pooh")
  .where(Where.property("age").gte(22)

@bevzzz bevzzz self-assigned this Jun 24, 2025
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 added 6 commits June 25, 2025 19:12
This allows higher-level queries like NearObject to add
filters without overwriting the ones set by users.
In general, this lets users call .where() multiple times,
in line with the principle of 'append-only' options.
Replace @see with See.
Refactor ById to use the new Where.uuid() shorthand.
@bevzzz bevzzz merged commit a2905ee into v6 Jun 26, 2025
2 checks passed
@bevzzz bevzzz deleted the v6-queries branch June 26, 2025 09:08
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