Skip to content
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

Update search operators #69

Merged
merged 1 commit into from
Apr 16, 2021
Merged

Update search operators #69

merged 1 commit into from
Apr 16, 2021

Conversation

valtlai
Copy link
Contributor

@valtlai valtlai commented Apr 16, 2021

Changes the search operators as follows:

  • ~= to *= (matching CSS)
  • ALL to &=
  • SOME to |=

@valtlai valtlai marked this pull request as draft April 16, 2021 07:37
@oscarotero
Copy link
Member

oscarotero commented Apr 16, 2021

I like it and understand the logic:

  • ~= to *=: Obviously.
  • ALL TO &=: & is like AND operator, so makes sense because we want all values are present
  • SOME TO |=: | is like OR operator, so makes sense because only one match is required.

@oscarotero
Copy link
Member

oscarotero commented Apr 16, 2021

Note that any condition without operator is interpreted as data.tags &=. So this new syntax should be updated also here:

lume/helpers/search.js

Lines 81 to 86 in ff5b9d6

if (!arg.includes("=")) {
if (!filter["data.tags ALL"]) {
filter["data.tags ALL"] = [];
}
return filter["data.tags ALL"].push(arg);

Changes the search operators as follows:
 - `~=` to `*=` (matching CSS)
 - `ALL` to `&=`
 - `SOME` to `|=`
@valtlai
Copy link
Contributor Author

valtlai commented Apr 16, 2021

Updated that and also a regex (at the same time, I also deleted the unnecessary escapes inside the character classes).

@oscarotero oscarotero marked this pull request as ready for review April 16, 2021 15:40
@oscarotero oscarotero merged commit 585df4c into lumeland:master Apr 16, 2021
@oscarotero
Copy link
Member

Look good to me. Thanks!

@valtlai valtlai deleted the search-operators branch April 23, 2021 11:58
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.

2 participants