-
Notifications
You must be signed in to change notification settings - Fork 568
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
In NEARBY, the LIMIT is applied before WHERE clause, not after #199
Comments
LIMIT/CURSOR are applied at the geo index level. WHERE works as a filter on those results prior to being sent to the client. I agree that this is counter-intuitive, especially when coming from a Postgres/MySQL where LIMIT/OFFSET are applied after the WHERE clause. All pageable commands, such as NEARBY/INTERSECTS/WITHIN/SCAN/SEARCH are designed to work this way. I think this behavior should be changed. I'll investigate further and keep you posted. Thanks |
Yes, as it exists now, the WHERE clause is not very useful -- I could do the same filtering myself if I first ask for limit and then iterate over a small number of results. As a workaround for "getting K closest items with the correct field values", I'd have to get e.g. get a thousand results with LIMIT 1000 then see if enough survived the filtering, and if not then repeat with larger limit etc. If there was a way to first "only consider items matching WHERE clause" and then "select KNN from those" it would be a super-useful feature. Thanks for considering this! Alex |
I just pushed an update that applies the LIMIT after the WHERE. Please let me know if you run into any issues. Thanks. |
Awesome, thanks! I was trying to build the current git version
Do you think this is a problem with my setup? |
It worked with go 1.8, maybe you need to update the build script to require that. Currently it asks for go > 1.5. |
Nice find. The build script now requires 1.7 or higher for 14cc6ce. |
The
NEARBY
returns nothing, although there's an object 2 that satisfies theWHERE
clause. It seems that the 1 closest object is first found, and then theWHERE
clause is applied, producing empty result list.This is counter-intuitive and unlike SQL, where LIMIT is applied at the end, after all WHERE clauses and just before returning the results. Is this behavior by design, or is this a bug?
The text was updated successfully, but these errors were encountered: