Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make cypht search shows latest results when searching in a mail box #765

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mmarcwabo
Copy link
Member

@mmarcwabo mmarcwabo commented Sep 13, 2023

Pullrequest

Make cypht search show latest results

Make default sort mode on search by internal date from the newest to the latest

Issues

  • None

Checklist

  • None

How2Test

  • Make a search from any page and notice that found messages at the top are the recent ones

Todo

  • Make sure sort by date choosen by the user works as well

@kroky
Copy link
Member

kroky commented Sep 15, 2023

Shouldn't we sort by the default field user is seeing messages sorted? Might be internal date, might be date of arrival.

@@ -1090,7 +1090,13 @@ public function search($target='ALL', $uids=false, $terms=array(), $esearch=arra
if ($esearch_enabled) {
$res = $esearch_res;
}
return $this->cache_return_val($res, $cache_command);
$found_messages_uids = $this->cache_return_val($res, $cache_command);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that we get all search results here? If they are paginated, sorting won't work afterwards.
Also, isn't there an IMAP command to search AND sort in one go?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that we get all search results here? If they are paginated, sorting won't work afterwards. Also, isn't there an IMAP command to search AND sort in one go?

According to my researches, yes: we get all of them, since the IMAP response ($status) is "OK" there.
Pagination is being processed when formatting as I observed.

Search and sort in one go with IMAP command: I'll look into this possibility and share my findings, so that you can advise.

@mmarcwabo
Copy link
Member Author

mmarcwabo commented Sep 16, 2023

Shouldn't we sort by the default field user is seeing messages sorted? Might be internal date, might be date of arrival

I have found that internal_date and date are the same. The goal here were to make sure by default newers messages are on top. I am still working on this PR to make sure that sort follows users choices / preferences (Ascending or Descending).

@mmarcwabo mmarcwabo marked this pull request as draft September 16, 2023 01:01
@kroky
Copy link
Member

kroky commented Sep 19, 2023

There are certainly 2 different dates that user can choose for default sort order in imap module - Date of the msg (date sent) and date of arrival (which is probably the internal date). I think we should be in sync here with the setting.

@marclaporte
Copy link
Member

@mmarcwabo Please take this over the finish line :-)

@TheDigitalOrchard
Copy link
Contributor

Just adding my 2¢, Cypht might have an opportunity to do truly smart searches... by doing a "relevance" search and sorting with the most relevant results at the top.

I haven't yet used Cypht in the real world, so this is just a thought off the top of my head.

@marclaporte
Copy link
Member

Just adding my 2¢, Cypht might have an opportunity to do truly smart searches... by doing a "relevance" search and sorting with the most relevant results at the top.

ok, let's track here: #959

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants