21
21
Search feature for GTG
24
* João Ascenso, GSoC 2011
25
* Izidor Matušov, Jan/Feb 2012
24
- João Ascenso, GSoC 2011
25
- Izidor Matušov, Jan/Feb 2012
27
27
You can search by entring a query in a simple language. Function
28
28
parse_search_query() parse the query and return internal representation which
30
30
the exception InvalidQuery is raised.
32
32
The query language consists of several elements:
34
* !not <elem> -- the next element will be negated
35
* <elem> !or <elem> -- return True if at least on of elements is true
36
* !after <date> -- show tasks which could be done after this date
37
* !before <date> -- show tasks which must be done before this date
38
* !today -- show tasks with due_date == today
39
* !tomorrow -- show tasks with due_date == tomorrow
40
* !nodate -- show tasks without due_date
41
* !now -- show tasks with due_date == now
42
* !soon -- show tasks with due_date == soon
43
* !someday -- show tasks with due_date == someday
44
* !notag -- show tasks without tags
45
* tags -- show tasks with this tag
46
* word -- show tasks which contains this word
47
* "literal" -- basically the same as word but allows the space and special
34
- !not <elem> -- the next element will be negated
35
- <elem> !or <elem> -- return True if at least on of elements is true
36
- !after <date> -- show tasks which could be done after this date
37
- !before <date> -- show tasks which must be done before this date
38
- !today -- show tasks with due_date == today
39
- !tomorrow -- show tasks with due_date == tomorrow
40
- !nodate -- show tasks without due_date
41
- !now -- show tasks with due_date == now
42
- !soon -- show tasks with due_date == soon
43
- !someday -- show tasks with due_date == someday
44
- !notag -- show tasks without tags
45
- tags -- show tasks with this tag
46
- word -- show tasks which contains this word
47
- "literal" -- basically the same as word but allows the space and special
48
48
characters inside. Literal must be inside "quotes".
49
* date -- date which could be parsed with Date.parse()
49
- date -- date which could be parsed with Date.parse()
51
Elements are supposed to be in conjuction, i.e. they are interpreted as
52
E1 AND E2 AND E3 AND E4 AND ( E5 OR E6 OR E7 ) AND E8 ...
51
Elements are supposed to be in conjuction, i.e. they are interpreted as::
52
E1 AND E2 AND E3 AND E4 AND ( E5 OR E6 OR E7 ) AND E8 ...
54
54
Examples of queries:
55
55
'!tomorrow !or !today' => show tasks which are today or tomorrow
63
63
search_filter() expect parameter 'q' which is a list of commands in the form
64
(name_of_command, should_be_positive, arguments). If
64
(name_of_command, should_be_positive, arguments). If::
65
65
should_be_positive == True => task has to satisfy this command
66
66
should_be_positive == False => task must not satisfy this command
74
74
For more information see unittests:
75
* GTG/tests/test_search_query.py -- parsing query
76
* GTG/tests/test_search_filter.py -- filtering a task
75
- GTG/tests/test_search_query.py -- parsing query
76
- GTG/tests/test_search_filter.py -- filtering a task