session-foundation / session-ios

A private messenger for iOS.
https://getsession.org
GNU General Public License v3.0
3 stars 1 forks source link

[BUG] <Search function for convo/conversations does not work correctly> #39

Open ghost opened 1 year ago

ghost commented 1 year ago

Code of conduct

Self-training on how to write a bug report

Is there an existing issue for this?

Current Behavior

Searching in "Contacts & Groups" does not work correctly. Example, I have a contacted named "X" I type "X" in, "X" does not show.

Expected Behavior

I have a contact named "X" I type "X" in, and "X" does show.

Steps To Reproduce

  1. In search function
  2. Type a contact or keyword
  3. See not relevant results show

iOS Version

iOS 16.7

Session Version

2.4.3 (427)

Anything else?

No response

KeeJef commented 11 months ago

Yeah this is a bit of an issue, we only support search for strings longer than 2 characters, otherwise things get tricky performance wise. A comprise might be to allow search for usernames / group names for less than 2 characters but still limit conversation searches. @mpretty-cyro thoughts?

mpretty-cyro commented 11 months ago

I do wonder if users will get confused as to why they aren't getting message search results when only entering a single character

I'll take a quick look so see what the performance is like for a single character search - I think the last time I actually checked were were using FTS4 (now have FTS5) and I'm not sure whether we had a limit on the search results (it's now 500 for contacts and 500 for messages)

mpretty-cyro commented 11 months ago

@KeeJef Ok did some quick testing on my main test emulator (which has quite a large database) and the results are:

Contacts & Groups

Messages

The query for global search is pretty complicated at the moment so this might be able to be improved (and potentially combined into a single query instead of two) but would require a decent chunk of effort so might be better left until we can move it across to libSession - I think the compromise you suggest is the best option for something sort-term

The contacts/groups search could be moved earlier than the messages, and even done in-memory instead of at the database level, but we'd need to decide whether we want to sacrifice some of the convenient things FTS5 gives us for free like matching similar words like "corrected" and "correcting" (which is probably more relevant for message searching)

KeeJef commented 11 months ago

@mpretty-cyro sounds reasonable, lets put this in the backlog for iOS

mpretty-cyro commented 11 months ago

Jira ticket is SES-1321