Skip to content

api: add API to get similar chats#4649

Merged
link2xt merged 2 commits intostablefrom
link2xt/get-similar-chats
Sep 5, 2023
Merged

api: add API to get similar chats#4649
link2xt merged 2 commits intostablefrom
link2xt/get-similar-chats

Conversation

@link2xt
Copy link
Copy Markdown
Collaborator

@link2xt link2xt commented Sep 1, 2023

This is an experimental lightweight chat grouping function, not exactly a replacement for "communities" or "spaces".

Comment thread src/chat.rs Outdated
Comment thread deltachat-ffi/deltachat.h
* @memberof dc_context_t
* @param context The context object as returned from dc_context_new().
* @param chat_id The ID of the chat for which to find similar chats.
* @return The list of similar chats.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would be nice to have a short explanation of the algo / similarity metric here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the get_similar_chat_ids function itself has some info, even if brief.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The algorithm is not part of the API and may be completely changed in the future, API users should not assume anything about it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe just mention here that the similarity is how much chats intersect in terms of their members? W/o any details about 42 days and so on. Personally i avoid to use things that i don't understand at all about how they work

Comment thread src/chat.rs Outdated
Comment thread src/chat.rs

// Select up to five similar active chats.
let mut res = Vec::new();
let now = time();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd use our chat timestamp instead of the current time, otherwise this functionality isn't useful for old chats

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i think it was on purpose to use "now" as reference -- we don't keep track when membership changed so we can not get "similar chats" as seen from some historic point in time anyway.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is still useful for old chats: the functions returns active chats similar to the old chats.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

But if there are no such active chats, it will return nothing. It may be strange for a user that yesterday it found smth, but today doesn't. If we want active chats to have precedence over old ones, we can add that to the comparison function used for sorting

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Moreover, i'd say that looking for some old chats is what sometimes needed. New ones are at the top of the chatlist, but old ones are usually not so easy to find by hand

Comment thread src/chat.rs
Comment thread src/chat.rs Outdated
Copy link
Copy Markdown
Contributor

@hpk42 hpk42 left a comment

Choose a reason for hiding this comment

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

thanks for adding this experimental function -- looking forward to using it once again.
The API should have an "experimental" marker for UI developers but otherwise lgtm.

@link2xt link2xt force-pushed the link2xt/get-similar-chats branch from db35db9 to 545283a Compare September 5, 2023 10:40
@link2xt link2xt changed the base branch from master to stable September 5, 2023 10:40
@link2xt link2xt force-pushed the link2xt/get-similar-chats branch from 545283a to efe01a5 Compare September 5, 2023 11:14
@link2xt link2xt force-pushed the link2xt/get-similar-chats branch from efe01a5 to b40843b Compare September 5, 2023 12:23
@link2xt link2xt force-pushed the link2xt/get-similar-chats branch from b40843b to e6904bc Compare September 5, 2023 12:28
@link2xt link2xt merged commit 30024ab into stable Sep 5, 2023
@link2xt link2xt deleted the link2xt/get-similar-chats branch September 5, 2023 16:47
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.

3 participants