Mailspring icon indicating copy to clipboard operation
Mailspring copied to clipboard

Custom sort functionality - Community#470

Open glenn2223 opened this issue 2 years ago • 7 comments

This update is a big step towards resolving https://community.getmailspring.com/t/custom-email-sorting/470


The update brings some basic sort functionality to the thread (including search results).

As I'm limited by the DB, you only have date and subject, from and size would require some extra fields (unread is possible, though we already have the unread "folder")

Currently the feature remembers the order and implements it when you switch folders or restart the app.


Q. This seems almost redundant as, after the first sort swap, it will never be triggered again. Maybe have the new setting set by default? Then this can be removed

https://github.com/glenn2223/Mailspring/blob/5b9493f87cef86c573593455844d330472d49e70/app/src/mailbox-perspective.ts#L412-L414

Q. Not sure about the naming of the new "setting"

Q. Where do we stand on increasing the sort by options?

glenn2223 avatar Aug 28 '22 23:08 glenn2223

This pull request has been mentioned on Mailspring Community. There might be relevant details there:

https://community.getmailspring.com/t/custom-email-sorting/470/7

foundry376-bot avatar Aug 28 '22 23:08 foundry376-bot

Hey @glenn2223 thanks for your work on this! I've been holding off on merging this one because I think it'd be cool to enable those other sort options too, but it looks like you're right that it'd require a pretty big database change that may not be worth the lift.

Have you had a chance to test this on a really large mailbox? The only other thing is making sure changing away from the default sort (to subject in this case) still uses an index in SQLite. It probably won't be noticeable with less than <10k messages.

bengotow avatar Oct 25 '22 11:10 bengotow

I have tried it on my main mailbox where the trash folder has over 71k messages. As you can see from the below, we'd definitely need an index.

image

I then created the below index

CREATE INDEX "ThreadSubjectIndex" ON "Thread" ( "subject" DESC );

And this was the result.

image

As we'd need to add an index it may be worth adding a size to the DB too. Then new messages can get the size from the IMAP server. Then, if a NULL value is found, a message could pop up saying "The results are incomplete. Fetch the missing information now?". What do you think?


I also considered the below:

CREATE INDEX "ThreadIsSearchIndexedSubjectIndex" ON "Thread" ( "isSearchIndexed", "subject")

but I didn't do a benchmark before the first index, above the line is before and below is after - as you can see there's almost no difference

image

glenn2223 avatar Oct 27 '22 13:10 glenn2223

Any update/thoughts @bengotow? Thanks for the other merge BTW

glenn2223 avatar Apr 12 '23 11:04 glenn2223

Merging this would go a long way to make mailspring usable as a daily driver. Please consider making it high priority.

alucryd avatar Dec 02 '23 13:12 alucryd

This pull request has been mentioned on Mailspring Community. There might be relevant details there:

https://community.getmailspring.com/t/sort-order-for-messags/7848/2

foundry376-bot avatar Feb 18 '24 23:02 foundry376-bot

Any news about this?

Sorting by date is extremely important and should be treated as a priority.

Without this I can't abandon Mozilla Thunderbird

luapfr avatar May 03 '24 18:05 luapfr