Skip to main content
Finds items by metadata alone, with no query vector. queryMetadata() resolves the filter against the encrypted metadata index and returns the matching IDs. With text, it also ranks matches by BM25 relevance. It works on untrained indexes.

Parameters

  • Without orderBy or text, results come back in no particular order.
  • Items missing the orderBy field, or holding a non-scalar value in it, sort last.

Filter constraints

query() falls back to a post-filter over decrypted metadata when the index can’t answer a filter, for pure vector queries. queryMetadata() has no fallback, so every filter must be answerable from the index. The index’s metadataSchema is therefore enforced here:
  • $regex and $contains need a field created with pattern: true.
  • A field created with filterable: false can’t be filtered on.
  • $type isn’t supported.
Any of these throws CyborgDBValidationError (HTTP 400) with the reason. Nested dot-paths such as 'loc.city' are supported.

Returns

Promise<MetadataResult[]>: one object per match.

Exceptions

  • orderBy is an object with more than one key, or isn’t a string or object. Thrown before any request is sent.
  • The service rejects the query (HTTP 400): see Filter constraints.
The indexKey or apiKey is invalid (HTTP 401).
The service returns 5xx.
See Errors for the full hierarchy.

Example Usage

Filter only

Operators and a result cap

Sorted by a field

Regex match

For filter syntax and operators, see Metadata filtering.