suchnsuch / Tangent

The publicly-available modules of the Tangent project.
63 stars 5 forks source link

Any way to show multiple hits in the same note when querying / searching? #83

Open riwoodward opened 1 week ago

riwoodward commented 1 week ago

The query tool is a nice way to find content in notes. I like the card view which shows the queried string in the context of the note.

However, it can be difficult to find what you want when a note contains the string more than once, since Tangent only shows the first 'hit' in each file and gives no indication there are other hits later in the file.

Consider the following Markdown file as an example:

There is some content here.

### FINDME here.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Maecenas porttitor congue massa.

Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna.

Nunc viverra imperdiet enim.

Fusce est.

Vivamus a tellus.

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

### FINDME here too.

Proin pharetra nonummy pede.

Mauris et orci.

Aenean nec lorem.

When I query for the string FINDME, Tangent shows clearly the first sentence containing it, but there's no indication that a 2nd sentence also contains FINDME in the note:

image

Of course I can scroll down within the note while in query view to find the other FINDME reference highlighted in green, but this doesn't work well when there are many notes to look through (or long notes).

As an example of other software that does this nicely, I mention Zettlr. Using the same query approach there, I see:

image Clicking on the line in Zettlr's query sidepanel jumps to the line in the note itself, so it's very easy to find all times a string appears in a note and jump to it.

Perhaps Tangent could consider enhancing the query results view to include the case for multiple hits within a single file. Maybe each card (i.e. file) could have a number on the preview showing "number of hits", or even a forwards/backwards button so the user can cycle through them quickly while previewing the little card? Just an idea.

taylorhadden commented 1 week ago

Yes, definitely a limitation. I like your notion of having some way of moving between highlighted sections. That's a good idea.

One eventual improvement I want to make to queries is being able to display things at a sub-note level, e.g. Lines with .... A significant piece of work, but it would multiply the utility of the query system.

riwoodward commented 4 days ago

Thanks and yes, that proposed sub-note level querying would be an amazing feature!