fsnotes icon indicating copy to clipboard operation
fsnotes copied to clipboard

Inconsistent Note Search Modes and [[]] links

Open pdanford opened this issue 3 years ago • 6 comments

Description

There are two search modes:

  1. search multiple notes for keywords (via the search or create field)
  2. from focused inside a note using F

These two regard the search keywords differently. Via # 1, it is "contains all words", via # 2 is as a phrase. Since # 1 method doesn't use phrases, [[some words]] links from within other notes do not work as expected.

To Reproduce

  1. Create 2 markdown notes with contents this is one sentence, and another with this is sentence one. These should be in the body of the notes, not the note names which should be unrelated.
  2. When performing a notes search for "this is one sentence" via the search or create field, both notes are returned, but searching inside the note bodies only matches the actual phrase in the note.
  3. [[this is one sentence]] from within other notes (i.e. a 3rd note) also returns more notes than expected because phrase matching isn't used for the search logic.

Expected behavior

  1. The search or create field should be using phrase matching (or turn on phrase matching when quotes are used - which it currently doesn't do)
  2. [[multiple words]] links in other notes should always use phrase matching. Otherwise, many notes are returned as matches because they contain all the words, but not the phrase. With many notes in existence, this renders [[]] intra-note linking much less useful.

FSNotes version

5.4.4

macOS/iOS version

macOS 12.5 (intel)

Additional context

This is tested using markdown notes.

The motivation for this is: Imagine the [[]] being used to refer to a markdown header inside another note somewhere.

pdanford avatar Jul 29 '22 00:07 pdanford

I can't reproduce this. With two notes named this is one sentence and this is sentence one, clicking a link [[this is one sentence]] within a third note always jumps to the correct one. Also clicking links does not affect the list of notes at all.

Are you using square brackets to start searches, rather than linking to existing notes?

tewe avatar Jul 29 '22 09:07 tewe

I can't reproduce this.

Note # 1 under To Reproduce says "with contents", not the name of the notes. The actual note names should be something unrelated. Imagine the [[]] being used to refer to a markdown header inside another note somewhere. I'll edit to make that more clear.

pdanford avatar Jul 29 '22 16:07 pdanford

I don't know where using double square brackets in Markdown originated, but the current FSNotes behaviour is consistent with nvALT.

tewe avatar Jul 29 '22 21:07 tewe

but the current FSNotes behaviour is consistent with nvALT.

I don't use nvALT, but if it's doing the same thing - using all words in any order instead of phrase oriented searches triggered from clicking [[some words]] - then nvALT should have bug report filed also IMHO.

[[]] triggered search/links to other notes not using phrase oriented search on note bodies makes [[]] far less useful when you have 100's or 1000's of notes.

pdanford avatar Jul 29 '22 21:07 pdanford

I have 8186 notes but only ever link to titles. That works, so I don't have a horse in this race.

One reason I'd recommend against relying on phrase searches is that when editing you'll never remember if you "linked" to that particular piece of text anywhere. So you'll either break "links" all the time or are inhibited in improving your writing.

tewe avatar Jul 29 '22 21:07 tewe

Yeah, I think your use-case example is different. Here's an example from my notes:

### VLAN Setup
more details here...

That get's referenced from other notes like this:

For more information, see [[VLAN Setup]].

So I'm not linking to words in the middle of paragraphs somewhere, which I think you were alluding to. I only link to markdown headings - which I never change accidentally via edits. So my use-case really wants [[]] to act like it does when searching file names - as a phrase. As it is now, I'll also get matches in all other notes which have sentences like "... and to setup the VLAN...", which kinda makes the [[]] search not helpful.

pdanford avatar Jul 29 '22 21:07 pdanford

If the link exactly contains the title or file name of another note, then NSSearchField does not get anything at all, the program goes directly to this other note.

I do not know how I can help in this case. But in any case, thank you for the feedback. And if you have any desire to improve application, pull requests will be considered and appreciated.

glushchenko avatar Sep 25 '22 20:09 glushchenko

In the case of the search field not containing a title or filename of another note, but rather search words to be found in the text bodies, is there a way to make that in-body search phrase based instead of any order of words based? Thanks, Peter

pdanford avatar Sep 25 '22 21:09 pdanford

Many people ask me about fuzzy search, so i can not just disable it https://github.com/glushchenko/fsnotes/issues/663

glushchenko avatar Sep 25 '22 21:09 glushchenko

Yeah, I see your point. What about only disabling fuzzy search when the search is initiated by clicking a [[]] link in a note? It's actually already like that when the words inside [[]] links turn out to be a filename - but reverts to fuzzy body search if no files with filename were found. Fuzzy search does make more sense when the search is initiated from people typing into the search field directly (which is the type of search I think #663 was referring to).

If people really want [[]] clicked searches to stay fuzzy also, it would be nice if there were a flag to control that, because fuzzy searches from [[]] clicked links really limit how much I can rely on cross linking technically oriented notes.

pdanford avatar Sep 25 '22 22:09 pdanford

...one other idea would be to introduce another link type like [[[ ]]] which would be phrased based instead of fuzzy.

pdanford avatar Sep 25 '22 22:09 pdanford