-
Notifications
You must be signed in to change notification settings - Fork 4
Add support for filtering to queryNearest #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add support for filtering to queryNearest #23
Conversation
…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.
|
I’m planning to drop the cjs path and that statement entirely soon. Sorry
it bit you!
…On Thu, Nov 6, 2025 at 8:54 AM MacKinley Smith ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In package.json
<#23 (comment)>:
> @@ -23,8 +23,8 @@
"scripts": {
"build": "npm run build:esm && npm run build:cjs",
"build:go": "cd src/s2-bindings && python build.py",
- "build:esm": "tsc --project ./esm.json && echo '{\\n \"type\": \"module\"\\n}' > dist/esm/package.json",
- "build:cjs": "tsc --project ./commonjs.json && echo '{\\n \"type\": \"commonjs\"\\n}' > dist/commonjs/package.json",
+ "build:esm": "tsc --project ./esm.json && echo -e '{\n \"type\": \"module\"\n}' > dist/esm/package.json",
Oof... turns out that echo -e is not supported on macOS, so I'm updating
this to use a node script for full cross platform support. Another option
is to use printf, but that might lose compatibility with Windows.
I sure am shaving yaks today.
—
Reply to this email directly, view it on GitHub
<#23 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACZQW64KT5JNGJV4M4EOOL33N4NZAVCNFSM6AAAAACLHWDVKSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTIMRZGM3DANRTGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Thank you for the approval, @sethconve! I have resolved the merge conflict on this branch and also opened another PR for my follow-on work to optimize the server-side aspect of this, #25. Please let me know if there's anything I can do to be helpful with getting this across the finish line. Cheers! |
commit: |
|
@mackinleysmith am I understanding correctly that #25 is basically a replacement for this branch? any reason to merge both? |
|
|
|
@ianmacartney yeah, #25 contains this branch so merging that one would be sufficient, so long as we're in agreement on that being the best approach for the database side of this. I tried to organize it so that this PR contains the interface level changes and that one contains query level optimization to better support it, but ran into some limitations with trying to give you guys an easy time reviewing them in isolation. Sorry about that! As for the new cjs-less flow, it seems to be working for me! I was able to upgrade my applications after merging master into my fork and was able to remove the customizations i introduced in package.json on this branch. Thanks for fixing that! |
This PR adds filtering support to the
queryNearestmethod, allowing users to filter results using the same filter builder API available inquery. This addresses the feature request in #17 and the discussion in the Discord thread.Changes
queryNearestsignature: The method now accepts an options object that can include bothmaxDistanceandfilterparameters, while maintaining backwards compatibility with the existing numericmaxDistanceparameter.query:eq()- equality filtersin()- value in a set filtersgte()/lt()- sort key range filtersnearestPointsquery to accept filtering conditions and sorting intervals, passing them through toClosestPointQuery.Example Usage
Benefits
querymethodmaxDistancecontinues to workTesting
mustandshouldfilter conditions inpointQuery.test.tsBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.