Foolscap was my answer to losing all my notes and forgetting the exact file I saved it.
Was it on Desktop or next to the project?
Thus I decided to write an application that took care of the saving and finding of my notes.
One thing I have taken for granted is the ordering of my files in any file system. I only realised how important it was after unordered dictionaries in python allocated my notes random positions on the list.
The random ordering meant if I have note "M" in
mind, it could appear anywhere on the list. So my
eyes would track down
n positions in the list to
find "M". An
O(n) operation for my eyes.
After growing tired (a whole day of
operations), I wrote the rule to provide me the
list in alphabetical order. This was great my
brain automatically switched to doing a binary
search for note "M".
Now that finding note "M" was optimised for my eyes, my finger had to press the down key until my cursor was on the note of choice. This wasn't good enough, I was referring to note "M" several times a day and the other notes I'd reference once a month were adding computation time to my finger.
This is where I introduced two of the most powerful rules of Foolscap. Since I tracked the number of views, and time it was last viewed or
modified I could implement the following ordering
1: LastView/Modified/RecentlyCreated 2: MostViewed 3: 2ndMostViewed 4: 3rdMostViewed 5: A 6: Z
This was neat!
I had significantly cut down the amount of time it took for me to get to the notes I was using most frequently.
Searching needed a slightly different ordering since applying the rules above to your search results will likely be meaningless. The meaningless will come from your inability to predict what will appear in the list to begin with.
Python has a neat method for it's strings.
Which I used as the initial search feature. A
search by the prefix of my note title. To me this
made sense since my notes are titled by their
subject matter, e.g.
The iteration to this search functionality was to
include the conditional
if "text" in note_title:
I still wanted to provide the user with the result of the initial prefix search as the first result in the list.
This is when I fathomed this solution
search = [title for title, _ in notes.items() if query in title] # Sort by the position the query appears in the title return sorted(search, key=lambda title: title.index(query))