-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
Filter Strings for Deck Editor search #3582
Conversation
3d3b7c2
to
8b8ced8
Compare
You mean scryfall syntax since they took over mci? https://scryfall.com/docs/syntax If it's the old mci syntax and that's any different, I wouldn't use that since the site no longer exists and people can't check the syntax or new users are not used to it at all. In general a very nice new feature though! 👍 |
My question is: Why doesn't this auto-create the filters in the filter section once they're typed up? Would make a bit more sense as why would we have two types of filtering operations? |
I tried generating the filter tree in v0, but it turned out the filter tree wasn't expressive enough to capture the kinds of queries you can write. |
What I really mean is http://magidex.com syntax : ) |
Scryfall syntax is almost exactly the same: https://scryfall.com/docs/syntax |
The joke is I made magidex.com before scryfall ;) |
cockatrice/src/filter_string.cpp
Outdated
auto op = sv[0].get<QString>(); | ||
return [=](int s) { | ||
if (op == ">") | ||
return s > arg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember in the past for a school problem I was able to convert the op string to a real op without switches... maybe I'm mistaken?
b81f9d3
to
46154f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me. More of an Easter egg than anything, but has no detriment to the program so I'm fine having it.
cockatrice/src/filter_string.cpp
Outdated
|
||
std::once_flag init; | ||
|
||
FilterString::FilterString(const QString &expr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would really like some comments in here
Should I add a tip of the day? |
Good idea, forgot about that 😅 |
hold on, do we now have two separate filter methods? we already have a entire separate filter widget and all. |
I agree, having two different ways to do the same thing (filtering cards in the deck editor), both of them not exactly clear to use and not well documented is not really good from an user perspective. |
I don't like the old filter system either. this would solve multiple issues with it. Documenting it well is a must. |
That would be great. Also, a history of the last used search queries, so that a recent search pattern can be reused easily. That would totally surpass the old filters capabilities and make it obsolete. |
3cce20e
to
a4a8d67
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parser isn't activated if a search only contains quotes"".
This means the search for "Birds of Paradise"
has no results, but the search "Birds of Paradise" t:bird
does what you'd expect.
This search overrules the filter widget, so setting a filter there for something like cmc = 5 and searching t:angel will still give angels of all mana costs.
If the old system is still there it should at least be told somewhere that they don't combine.
The clickable link for c:(l,c)
in the syntax help has an added brace to the right, clicking it results in c:(l%2Cc
being inserted in the search bar with no results. Other links with ,)+
in them don't work either.
Inserting c:(l,c)
doesn't actually work either. Other searches with (),+
in them don't work either.
The format filters f:
and banned:
don't actually work, unsurprisingly as this data isn't stored in xmls afaik. They should be removed from the syntax help.
The filter for rarity r:
doesn't work even though mentioned in the syntax help.
Searching for o:{T}
doesn't work, o:"{T}"
does work, this should be changed in the syntax help.
Searching for c:wu
doesn't work, nor does any combined letter combination, single letters as c:w
work fine.
Searching for c!w
doesn't work, nor does the ! syntax in any combination.
863feb2
to
ffa38c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There still are a few things in the syntax guide that don't work as expected:
- while
c:m
does workc:mw
orc:wm
ignores m and filters exactly likec:w
c!uw
actually only tests if a card is bothc!uwm
gives no results at allc=
doesn't work at all and gets mojibaked when clicked as well, just like ! used to,
doesn't work, instead some form of or keyword might be bettere:lea+leb
doesn't work and clicking it insertse:al,be
instead, same fore:lea,leb -e:lea+leb
** just replacee:lea+leb
withe:lea e:leb
also:
e:
doesn't work for sets with a number in them like 6ed or cn2- the keyword for toughness sorting isn't mentioned in the syntax help even though it's easily assumed to be
tou
c!c
doesn't work, in theory it should give the same results asc:c
- closing the cockatrice main window should close the syntax help window as well
They should be, update your card database? |
My bad, they work fine. |
cockatrice/src/tab_deck_editor.cpp
Outdated
@@ -700,7 +704,11 @@ void TabDeckEditor::updateCardInfoRight(const QModelIndex ¤t, const QModel | |||
|
|||
void TabDeckEditor::updateSearch(const QString &search) | |||
{ | |||
databaseDisplayModel->setCardName(search); | |||
if (search.contains(QRegularExpression("[:<>=\"!]"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be a tad more efficient to store the regex instead? afaik qt does some optimization for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, having a const QRegex is better
|
52204bb
to
9d9b109
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c:m
now doesn't work at all anymore. c:uwm
now does work though.
7498aeb
to
8c0852c
Compare
Can you link the syntax help window so that it closes when you close the main window? |
considering this will add legality to oracle, linking #3406 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're currently unable to chain multiple ors, that is the search for gruul or azorius or simic
doesn't work. Note that this search does work if you use grouping: (gruul or azorius) or simic
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
certified grade A ebbit-proof
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to do one more pass through
Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>
Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>
…ockatrice#3594) * I heard you like refactors so I put a refactor inside your refactor so you can refactor while you refactor * clangify * Update tab_deck_editor.h
Cleanup and refactor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great change. Will launch a beta!
Related Issues
Short roundup of the initial problem
Searching cards in the deck editor is hard.
What will change with this Pull Request?
Screenshots