-
Notifications
You must be signed in to change notification settings - Fork 376
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
Todo.txt advanced search system #1901
Conversation
app/src/main/java/net/gsantner/opoc/frontend/GsSearchOrCustomTextDialog.java
Show resolved
Hide resolved
app/src/main/java/net/gsantner/opoc/frontend/GsSearchOrCustomTextDialog.java
Show resolved
Hide resolved
Description of the advanced filter syntaxI will add this to the source and a few other places soon. The todo.txt advanced filter syntax allows one to filter todo items using a simple query language. For example Filter types
Operators
EvaluationThe filter expression is evaluated left to right (i.e. 'and' and 'or' have the same precedence). 'Not' is applied to the result of the expression to it's immediate right. Done tasks are not excluded by default. They must be excluded explicitly. Examples:
A note on implementation:
|
This is basically ready to go. TBD:
|
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.
My suggestion: Reduce the amount of possible operators to minimum. This makes it later more easy to migrate to something else if required, and to support by other means (uh oh, suddenly somebody comes up with the idea to use this operator stuff somewhere else?!).
What happens when "or" "and" "AND" "OR" are reserved keyword is also that they are excluded from being usable (you can't search for todos containing "and"). With it also comes, how to deal with translations, why can't I as a german user type "blau oder gruen und gelb"??!^^
So I suggest to keep it simple: Boolean operators, no logical keywords generally. For todo.txt specific case with "today", "nopriority" - this is fine, and we also can't magically invent a operator for them 😃.
Yeah. I see your point. I'll make the change when I am able - probably not this week :( I thought nopriority etc were acceptable as we already use 'due' etc as keywords. But I think I know of a way around even that. |
No stress, and make it like you want it. It's my suggestion, not the must. For due etc I think thats fine |
I've updated this to reduce the reliance on special words. Still not happy with |
It's OK if it's not perfect, it's never perfect^^. So if it's some todo specific keywords, thats fine |
I know. I just want to get it to a stage where I am satisfied (after all, I am building this for me :p) |
Updated. I think I am happy with this form. Of interest: I found this a couple days ago: https://github.com/ransome1/sleek/wiki/Filter-Expressions-for-Advanced-Search The syntax is not exactly the same, but it is close enough for comparison / inspiration |
@@ -355,6 +351,22 @@ public void toggleFavouriteFile(File file) { | |||
private static final String PREF_PREFIX_AUTO_FORMAT = "PREF_PREFIX_AUTO_FORMAT"; | |||
private static final String PREF_PREFIX_VIEW_SCROLL_X = "PREF_PREFIX_VIEW_SCROLL_X"; | |||
private static final String PREF_PREFIX_VIEW_SCROLL_Y = "PREF_PREFIX_VIEW_SCROLL_Y"; | |||
private static final String PREF_PREFIX_TODO_DONE_NAME = "PREF_PREFIX_TODO_DONE_NAME"; | |||
|
|||
public void setLastTodoDoneName(final String path, final String name) { |
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.
setPerFileTodoTxtDoneFilepath ?
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.
We force the done file to be in the same folder as the todo.txt file, so it is a name and not a path. And the other per file functions are all setLast*. We can change this, but I think we should change them all if we change this one.
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.
Oh I thought you did some change to select the file from anywhere, didn't check that
app/src/main/java/net/gsantner/markor/frontend/textview/TextViewUtils.java
Show resolved
Hide resolved
@gsantner Not sure if you are waiting for me to address any issues here. Please let me know if you are. Thanks |
In this PR I have created a fully functional advanced search / filter system for todo.txt
For example
@home & (pri:A | pri:B)
will return tasks with priority A or B and which have the context @home. The existing filter system has been updated to work on top of this query language (i.e. by generating the appropriate query).This is now fully functional and works correctly.
Remaining tasks:
Other fixes in this PR include: