-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Improve eq operator in where function #11287
Comments
The above is rather technical use cases ... I can understand if you want to find all pages tagged with Note that Go cannot compare slices directly, so it would be a fairly costly operation if implemented. |
I'm fine with with limiting to one tag. The specific example is:
Find all publications where John is the only author. (common) |
Go 1.21 introduced the slices package which contains https://pkg.go.dev/slices#Equal. |
The functional part of this has never been the challenge. If you look at that implementation you will find a ... loop. |
Understood. Will stick with...
|
To be clear:
Would be cheapish to implement with strict ordering (['foo', 'bar'] != ['bar', 'foo']), but I'm not sure how useful that would be. |
I agree that strict ordering limits its usage; not sure I'd pursue it. |
Use case 1: find all pages where tags equals
['foo']
.Use case 2: find all pages where tags equals
['foo','bar']
.This is not possible today. You can find all pages where these tags intersect a provided slice, but you cannot compare slices with the
eq
operator.The
eq
operator does work if your front matter is a scalar, e.g.,But you can't do this:
You should be able to get both of the pages above with:
The text was updated successfully, but these errors were encountered: