Skip to content

Conversation

@saihaj
Copy link
Contributor

@saihaj saihaj commented Feb 26, 2022

Closes #3293
Precede #3191

Comment on lines 823 to 852
| StartsWithInsensitive(attr, _)
| NotStartsWith(attr, _)
| NotStartsWithInsensitive(attr, _)
| EndsWith(attr, _)
| NotEndsWith(attr, _) => {
| EndsWithInsensitive(attr, _)
| NotEndsWith(attr, _)
| NotEndsWithInsensitive(attr, _) => {
table.column_for_field(attr)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but it might be a sign that we could use a EntityFilter::attr(&self) -> Option<Attribute> getter method for conciseness.

Maybe we could open a new issue for this.

Comment on lines -873 to +911

let operation = match (strict, negated) {
(true, true) => " not like ",
(true, false) => " like ",
(false, true) => " not ilike ",
(false, false) => " ilike ",
};
match value {
Value::String(s) => {
out.push_identifier(column.name.as_str())?;
if negated {
out.push_sql(" not like ");
} else {
out.push_sql(" like ")
};
out.push_sql(operation);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@lutter
Copy link
Collaborator

lutter commented Mar 3, 2022

This might be bikeshedding, but could we rename the filters from _insensitive to _nocase? That sounds a little more natural to me, and I hate being insensitive ;)

@saihaj
Copy link
Contributor Author

saihaj commented Mar 6, 2022

updated @lutter :)

Copy link
Collaborator

@lutter lutter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the change!

@evaporei
Copy link
Contributor

@saihaj can this be merged?

@saihaj
Copy link
Contributor Author

saihaj commented Mar 21, 2022

@saihaj can this be merged?

Yes @otaviopace I don't know if I am allowed to merge or if there are blog post or something we would want for this?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add new filters for case insensitive match _contains_insensitive , _starts_with_insensitive, _ends_with_insensitive

5 participants