Skip to content

Conversation

@mackinleysmith
Copy link

This is a follow-on for #23 -- apologies if there is a better way to set the base branch here, but I couldn't find it, so this contains the content of both PRs.

Summary

  • Wire the queryNearest client helper to the same filter builder used by rectangle queries, carrying filtering and sorting.interval through the Convex query layer.
  • Extend the backend nearest-point execution to intersect indexed FilterKeyRange streams with cell scans so must/should clauses are enforced before document fetches.
  • Refresh generated Convex component bindings to TypeScript, align the README docs with the new API shape, and surface the filter/indexing behavior to users.

Details

  • Client: GeospatialIndex.queryNearest now accepts either a distance or options object and builds filter/sort intervals that are passed to component.query.nearestPoints.
  • Server: ClosestPointQuery factors in filter conditions when choosing cell subdivisions and merges FilterKeyRange streams via Intersection, using PREFETCH_SIZE from the shared constants module.
  • Docs: clarify how indexed filters and maxDistance interact, emphasizing the performance win from narrowing the search space.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…rting options. Update README to reflect new options for maxDistance and filtering logic. Modify API definitions and implementations to support must/should filter conditions and sorting intervals. Add tests for new filtering functionality in closest point queries.
… and improve performance. Introduce a new buildStreamForCell method to manage filter conditions and optimize data retrieval. Update README to clarify maxDistance usage and filtering logic. Add tests for multiple filter scenarios in closest point queries.
…performance. Replace the buildStreamForCell method with direct database queries for point retrieval, enhancing clarity and efficiency. Introduce new helper methods for filter checks and sorting interval validation.
…etrieval and improving filter checks. Add methods for managing cell processing and fetching point entries in batches, optimizing performance and clarity in the query logic.
…precated filter methods. Introduce FILTER_SUBDIVIDE_THRESHOLD for enhanced performance in point retrieval, streamlining the query process.
…ove point retrieval logic. Introduce CellStreamState for better state handling during processing, and optimize filter checks and batch processing for improved performance.
…necessary type assertions and directly using the context in query executions. This improves code clarity and maintains functionality.
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 12, 2025

Open in StackBlitz

npm i https://pkg.pr.new/get-convex/geospatial/@convex-dev/geospatial@25

commit: 6f4b7ba

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.

1 participant