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

Add `or_filter` (this name is terrible we need a better one) #1389

Closed
sgrif opened this Issue Dec 13, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@sgrif
Member

sgrif commented Dec 13, 2017

This method would basically behave the same as filter, but if an existing where clause exists, it would combine with OR rather than AND. As an example use case, crates.io has a very large, complex, dynamically constructed query. However, regardless of whatever other conditions are added, they virtually always want to include a crate "if its name is an exact match for the search term". It would be very useful for that case to be able to put at the very end of the query construction, something like .or_filter(exact_match).

I actually considered a method like this back in 0.1, but considered it to generally be a smell, since we already have .or on ExpressionMethods. However, I'm starting to think that it's reasonable to provide this, since filter is the only method in our query builder which concatenates rather than overrides, and it seems reasonable to allow concatenating with OR rather than AND.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment