Search Query Operator - Math, Results Manipulation, Text Manipulation

Use case or problem

As a user, i would like to leverage graph capabilities to perform simple statistical analysis, text manipulation of the query output, and block manipulation of the text in the note.

Use case 1: Simple statistics for a habit tracker.

I have a checkboxes that are in each of my daily notes that:

  1. Track medicine, vitamins, supliments
  2. Define process for the day (check email, check messages, respond, do day planning, write a journal entry.

I would be great to be able to run a query to find how well/often I take my vitamins etc. Or how often I forget to check my email (okay that never happens, but just illustrating the point)

Use Case 2: Simple statistics and results sorting Todos, thoughts, Idea blocks

I generally scatter todos all over my notes, and then use queries to aggregate them into one list. I would be nice to count how many todos I have open, be able to sort and prioritize them when displayed. Ideally this would be persistant somehow.

Use Case 3: Block Cleanup.

Note this is probably the wonkyest feature request but including it for completeness.

Completed todos remain at rest within the document in the original scattershot location. Ideally I could define an cleanup operator that either, deletes the completed block, moves it to a new location within the file (like the end) or moves it to a new note.

Proposed solution

This probably the most difficult thing to define in an elegant way.

Perhaps some footer text at the end of the query block that can display a simple sum, total count, count per file, last modified time for the file, file size, etc. It would also be good to have a subquery on the results to aggregate from. Example: Query returns 100 lines, 35 contain #work 10 are checked.

These metrics could then be used to sort the results of the query (Use case 2)

For usecase 3 we could just have a cleanup operator that runs against all todos with checkmarks and cleans up with 3 options: delete block, move block to end, or move block to another file (with filename specified)

Current workaround (optional)

At the moment,I have a shitty python script I wrote to query the files and create an index file with block embeds. (I created this months ago before query block came out). It does the following:

  1. Regex against all files and isolate the blocks that match the query
  2. Add a blockid to the end of the line with a user defined prefix and a zettle uid example: ^TODOID20204343348909
  3. If a block matches and is a done checkbox, then move it to the end of the file
  4. Load matched all blocks into a pandas dataframe
  5. Group and split by tag, sort by timestamp (zettleid)
  6. Create a new file will all the aggregated tags and embedded blocks.

I was thinking of writing an indexing plugin but you guys beat me to the punch. Also I think that this would be better if it natively hooks into the query block