Skip to content

Blueprint better search in tasklist

jaap-karssenberg edited this page Nov 21, 2013 · 1 revision

What

  • Make the tasklist search support the same expression syntax supported by the search dialog
  • Add a "limit to current namespace" checkbox, similar to search dialog

How

Make query object in search configurable - allow to set keywords, default keyword

Then:

  • In the dialog create a Query of: ((parsed filter text) and checkbox and (tag selection))
  • Create a function to evaluate this query on a line item in the treeview
  • Set this method as a filter in the treeview (so treeview just gets method - dialog constructs it)

Keywords:

  • Task == description
  • Prio == X > X < X >= X <= X
  • Date == X > X < X >= X <= X - where X can be YYYY, YYYY-MM YYYY-MM-DD or MM-DD
  • Page
  • Namespace
  • Tag

Special case for “Tag: None” and “Date: None” → search items that have no tag / date

Special case for “@tag” → convert to “tag: tag” + be robust for “tag: @tag”

Bonus: See if using parser logic for expressions in new template code can help to make search expression parser more robust; implement grouping with "()" in syntax (even though not supported by official Xesam syntax).

Query syntax

  • Check XDG spec for query language to see how to specify keyword > < >= <=
    • was called “xesam” by website is gone now :( see below for resources

From http://stuff.mit.edu/afs/athena/astaff/project/emacs/source/emacs-23.1/lisp/net/xesam.el

;; * Xesam End User Search Language queries.  The Xesam query language
;;   is described at <http://xesam.org/main/XesamUserSearchLanguage>,
;;   which must be consulted for the whole features.
;;
;;   A query string consists of search keys, collectors, selectors,
;;   and phrases.  Search keys are words like in a full text query:
;;
;;     hello word
;;
;;   A selector is a tuple <keyword><relation>.  <keyword> can be any
;;   predefined Xesam keyword, the most common keywords are "ext"
;;   (file name extension), "format " (mime type), "tag" (user
;;   keywords) and "type" (types of items, like "audio", "file",
;;   "picture", "attachment").  <relation> is a comparison to a value,
;;   which must be a string (relation ":" or "=") or number (relation
;;   "<=", ">=", "<", ">"):
;;
;;     type:attachment ext=el
;;
;;   A collector is one of the items "AND", "and", "&&", "OR", "or",
;;   "||", or "-".  The default collector on multiple terms is "AND";
;;   "-" means "AND NOT".
;;
;;     albinus -type:file
;;
;;   A phrase is a string enclosed in quotes, with appended modifiers
;;   (single letters).  Examples of modifiers are "c" (case
;;   sensitive), "C" (case insensitive), "e" (exact match), "r"
;;   (regular expression):
;;
;;     "Hello world"c
----
Clone this wiki locally