TriliumNext / Notes

Build your personal knowledge base with TriliumNext Notes
https://triliumnext.github.io/Docs/
GNU Affero General Public License v3.0
975 stars 56 forks source link

(Bug report) Searching with orderBy doesn't work with dated attributes #441

Closed brianvanderburg2 closed 4 weeks ago

brianvanderburg2 commented 1 month ago

TriliumNext Version

0.90.5-beta

What operating system are you using?

Other Linux

What is your setup?

Local (no sync)

Operating System Version

Debian

Description

Search string in a search note is "#bill orderBy #due". #due labels are set on notes in the form YYYY-MM-DD, however it only seems to sort based on the YYYY portion

Error logs

No response

brianvanderburg2 commented 1 month ago

This appears to be caused by src/services/search/expressions/order_by_and_limit.ts. The function isNumber reports that a string of form "####-##-##" is a number since parseInt will parse it down to just the year, then parseFloat used in execute does the same and strips it down to just the year. The ordering works, but only based on the year and not the entire date string.

eliandoran commented 1 month ago

@brianvanderburg2 , wonderful analysis, I'll have a look.

eliandoran commented 4 weeks ago

@brianvanderburg2 ,

Should be solved by https://github.com/TriliumNext/Notes/pull/451.