microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.64k stars 6.57k forks source link

OneNote plugin : improve finding notebooks, sections and page title #22153

Open Fred-Vatin opened 2 years ago

Fred-Vatin commented 2 years ago

Description of the new feature / enhancement

Current behavior

Currently, it seems running the query in the page content and prioritize those results. This fails to bring up a relevant result.

Examples

If I have a section named MS Office searching for this exact string will return only pages containing this string and not the section itself. It feels strange.

Same if I have this time a page named Test, it will bring up every page containing the string test first instead of rank up the page where the string is in the page name.


Improvement idea

  1. Always rank the results according to where the query is found. First in notebook name, next in section name, next in page title, then in page content.
  2. Allow syntax to filter results according to their type : notebook, section, page title, content
  3. Allow syntax to narrow search like a path but still being fuzzy.
    1. If I have multiple pages titled Test in different section and notebook, I’d like to find them according their location. Let’s say current location is Notebook: “Coding”, Section: “Powershell” I could type : c/ps#test to bring up this page as the first and probably only result matching this path.
  4. Add an option to open results in a new OneNote session because I often have one session already opened that I don’t want it to be replaced.

How this last feature could work

Idea 1

As soon as the plugin detects a slash / or backslash \ or a # in the search, it should infer that strings on the left and right of it are in hierarchical relation and # as prefix always to a page title. If it doesn’t find any title. It search for content with this string.

Every page has a path like : onenote:https://d.docs.live.net/some_id/Documents/Notebook/Section%20Title.one#Page Title&section-id={some-guid}&page-id={some-other-guid}&end

Maybe it could be used as a schema. It seems the plugin can access the page location with

@$"{p.Notebook.Name}\{p.Section.Name}\{p.Name}"

Idea 2

A syntax to filter results according to their type. Any idea welcome. Here is mine.

At least, the # for page name should be the most useful on a daily case to narrow the results to only a few easy to scan.

Most of the query could be like #page name to search for page name containing the page name. And #page name/string to search any string in the page where name containing page name.

#page name could be in a fuzzy query to return result. To take up the earlier query example : c/ps#test for Notebook: “Coding”, Section: “Powershell”,Page: “Test”I could instead make a query like#n:c/#s:ps/#test. I don’t like it very much but may be easier to implement than the simplec/ps#testor simplyps#test` because not most of the time it will be enough to get exactly the page we want.

Scenario when this would be used?

Get the very notebook or section or note we want to jump into just by passing a prefix.

Supporting information

No response

palenshus commented 1 year ago

I just came here to file a similar issue, to get notebook/section titles to show up in search. I like your idea of sorting them based on the hierarchical relevance as well. That could be implemented pretty easily. Is that something you want to tackle?

Fred-Vatin commented 1 year ago

Unfortunately, not my specialty and no time right now.