New search node “
I have implemented a search node which makes it possible to filter cards by comparing fields and properties numerically (code on Github).
math:[mathematical expression][<|>|=|>=|<=|!=][mathematical expression]
The expressions may contain numbers, the operators
[+|-|*|/], the property variables
[due|ivl|ease|lapses|reps] or any other string which will be interpreted as a field name.
"math:Freq 1<Freq 2"
... finds notes which have fields “Freq 1” and “Freq 2” and where the value in the former is numerically smaller than the one in the latter.
... finds cards which have less than 5% of their current interval remaining (useful for studying ahead).
... finds cards where lapses account for more than 20% of the reviews.
TodosThe code is fully functional and ready to go. There are a few features left that might be nice to have, though: *
Escape characters (so field names containing “-”, “!” etc. can be used)*
Real division (currently,*
- Maybe filtering out notes with non-numeric content in a specified field (oversimplified, non-numeric strings are interpreted as 0 by SQL)
Maybe multiple equation operators (
FeedbackIf you have any use cases where this functionality would be advantageous or can think of a feature that would add even more benefit to it, I would love to hear about it.
And now the question of questions: Would you accept a pull request once the aforementioned issues are addressed, @dae ?
* edited lines