Skip to main content
Declare the geometry field last in an index entry, after the fields that partition it:
Read through the table’s addresses, so the table’s label applies:
  • .near(field, origin, { distance }) ranks facts by distance from origin. Each hit is { fact, score }, with score the distance in metres; distance caps it.
  • .region(field, area, { relation, distance }) selects the facts whose geometry relates to area: "intersects" by default, or "within", "coveredBy", "covers", "contains", "disjoint", "equals", "touches", "crosses" or "overlaps". With distance, it selects the facts within that many metres of area.
  • Both are always bounded by .first(n). The .where fields must fix the index’s partition fields.
A query over these addresses is watchable like any other: a client’s watch or useWatch re-runs it when a write lands in what it read. This is a spatial index over geometry. For embedding vectors see Ranked indexes.