-
Notifications
You must be signed in to change notification settings - Fork 46
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
SliceIndex query ContainsAll not working #137
Comments
Thanks for the detailed issue and test repro. I'll take a look. |
Absolutely. Sorry about the formatting issues! You may need to add back in the ` backticks in the event structs. |
I edited your comment to fix the formatting, FYI. |
Ok, there is definitely a logical inconsistency here with ContainsAll. The slice indexes store the slice values individually, but ContainsAll needs to compare them as a group. I just need to figure out the best way to handle it. The easiest option is to simply ignore the Index request in the query, like I do for "MatchFunc"queries where any value (like those not in the index) can be matched against, but that may not be the most performant. |
Thanks for confirming there is an issue there. I came to the same conclusion, ignore the index request and all is still working. Thank you |
Indexes can't be used efficiently with ContainsAll queries because all values in the index need to be checked. Instead we just short circuit the index lookup like we do for MatchFunc
Master branch should work for you now. |
Hello,
Recently I found an issue with querying using the ContainsAll criteria.
Using the unit tests provided in index_test.go I was able to confirm this by adjusting theTestSliceIndexWithPointers to the following.
I updated the tests in 2 ways, first to not use Categories []*string but instead to Categories []string instead. Secondly, I updated the store.Find ContainsAll call to include both {cat1, cat2} (multiple items to search for, not just one). The test looks as follows and fails when it should succeed:
The test expects the variable in e1 to be returned, but it is not found when run with an index.
Remove the .Index("Categories") qualifier and it succeeds.
The text was updated successfully, but these errors were encountered: