zadam / trilium

Build your personal knowledge base with Trilium Notes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Global search finds notes with 'whitespace' inside search term ???

LorenAmelang opened this issue · comments

Trilium Version

0.56.2

What operating system are you using?

Other (specify below)

What is your setup?

Local + server sync

Operating System Version

Win10, cc sync server, iOS web access

Description

When I use the top left global search, it finds notes that do not actually contain the search term.

Trilium search whitespace

(That's Safari on the iPad showing the cc server, but the same thing happens in local Windows.)

Search in note does not find the term in these notes, but searching for parts of the term has led me to something like the above in each case. The letters of the search term with some kind of space or formatting between them. At first I thought the "1 of 0" indication was a symptom of the error, but I see that is shown whenever the term is not found.

Would be wonderful if the global search showed a few words around each found search term - things like this could be quickly ignored. Showing note properties and headers doesn't help at all in knowing if the search hit is useful.

commented

Hi, search strips the HTML tags before finding the words. I think that e.g. having something like cht</p><p>H might produce this effect. Could you send me the exported note to zadam.apps@gmail.com to confirm this? Or just the relevant HTML chunk?

Exported:

<br>Enhanced Skin Permeation of Estradiol by Dimethyl Sulfoxide Containing Transdermal Patches <br>by Anna Otterbach and Alf Lamprecht</p> <p>Pharmaceutics 2021, 13(3), 320;&nbsp; <br>https://doi.org/10.3390/pharmaceutics13030320

So yes, if you strip the tags, there are no text spaces between "ht" and "P":
ht</p><p>P
and htP does match the search term.

I edited the note to look like:
Enhanced Skin Permeation of Estradiol by Dimethyl Sulfoxide Containing Transdermal Patches by Anna Otterbach and Alf Lamprecht Pharmaceutics 2021, 13(3), 320;  https://doi.org/10.3390/pharmaceutics13030320

Had to add the space manually. And it is no longer wrongly found.

So is there anything to be done about this? Teach global search to add a space when it strips a tag? Make a search in note option to strip tags so it is easier to find the problem hits?

Really the best solution would be to preview the global search hits in the mouseover of the first results, with a bit of surrounding text so we can see if the hit is real and relevant without even looking at the note!

commented

I fixed this by replacing all tag occurrences by a whitespace. It's far from ideal, since it opens another class of bugs - words with substring tags will not be found, but I suspect it's a much smaller use case than minimized-HTML with no extra whitespaces.

Wow - Thank You! Should make a huge reduction in my false search hits.