Signal-Android icon indicating copy to clipboard operation
Signal-Android copied to clipboard

Search doesnt find groups

Open kstrel opened this issue 12 years ago • 3 comments

Groups that are visible in the regular conversations view are not found when searching for their names. Its probably the same issue that has been pointed out here http://support.whispersystems.org/customer/portal/questions/8473126-can-t-see-send-to-groups

I am quite sure that this was not the case back in July. If I recall correctly then it was also possible to find the groups in the contacts screen (the one that pops up when hitting +).

Device info: HTC Desire HD, Cyanogenmod 7.3, TextSecure 2.1.8

kstrel avatar Sep 28 '14 20:09 kstrel

Thanks @kstrel, good find!

mcginty avatar Sep 28 '14 23:09 mcginty

The issue here is that group thread id's don't match the thread database query. Currently group thread id's use the following:

Say we have a group with contacts with id's of 23, 44, and 55. We might find one of those contacts and search for an equals relationship so = "23" but the groupId is "23 44 55", thus an equals query does not find it.

I've added a matching scheme that uses the limited matching enabled by the LIKE expression in sqlite. This will solve the problem but is inefficient because the scheme used for creating id's does not work with the capabilities of sqlite. In the above example each of the three id's requires a different matching query using like. "% id %" will work for 44, but not 23 or 55 for instance. The first and last id's also have their own quirks that require each one have its own matching expression. Ideally we would change the scheme so that there is no need to match a first id, middle id and last id.

I propose this be fixed by using the following format " id " for all id's, so a group would look like: " 23 44 55 " (1 space at most separating each and 1 space on either side always).

This can be matched using a single LIKE query for "% id %", which will scale better for people with large address books. There appear only a few points of construction of recipientIds for the database, so refactoring it shouldn't be difficult. I will post an alternate pull-request fix for this shortly and let you choose which option works for you as I am not intimately familiar with your motivations. I think the latter option is better personally.

fix8oscill8 avatar Oct 06 '14 21:10 fix8oscill8

After coding up the alternate I proposed above, I realized that this alternate would require existing users to migrate their entries so as to comply with the new thread database scheme. Since this would be getting more involved (adding a database entry to mark them as migrated, and a method to migrate their entries to be valid in the 'new' scheme) I thought I would wait for consensus before going ahead.

I have two references to this issue (both the original fix which doesn't require a thread db migration) that look identical, please use f1344fa just above this comment.

The alternative fix (which requires thread db migration, and the code to effect such a migration) is in https://github.com/fix8oscill8/TextSecure/tree/fix-search-for-groups-option-2

fix8oscill8 avatar Oct 06 '14 23:10 fix8oscill8