Closed Bug 1019245 Opened 10 years ago Closed 7 years ago

[Messages] When showing the suggestions list, order by most used contacts first, then order by alphabetical order

Categories

(Firefox OS Graveyard :: Gaia::SMS, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(b2g-v1.3 affected, b2g-v1.4 affected, b2g-v2.0 affected)

RESOLVED WONTFIX
Tracking Status
b2g-v1.3 --- affected
b2g-v1.4 --- affected
b2g-v2.0 --- affected

People

(Reporter: ckreinbring, Unassigned, Mentored)

References

Details

(Whiteboard: [2.0-flame-test-run-1], [2.0-flame-test-run-2][sms-papercuts][lang=js])

Attachments

(2 files)

Description:
Contacts in the result panel of the To field while creating a new message are not shown in alphabetical order.  They seem to be listed with the text matching the first name at the top, with the last name matches listed afterwards.

Repro Steps:
1) Update Flame to Build ID: 20140530040207
2) Have contacts with phone numbers in the contact list.
3) Launch the Messages app and tap the New Message icon.
4) Tap the To field and start type a character associated with multiple contacts.
5) Observe the appearance of the contacts in the result panel.

Actual:
The contacts in the result panel are not shown in alphabetical order.

Expected:
The contacts in the result panel are shown in alphabetical order.

Environmental Variables
Device: Flame 2.0
Build ID: 20140530040207
Gecko: https://hg.mozilla.org/mozilla-central/rev/e6f113c83095
Gaia: 26d8fcab9b61f46451600f39c51e0387ef3c4f88
Platform Version: 32.0a1
Firmware Version: V10g-2
User Agent: Mozilla/5.0 (Mobile; rv:32.0) Gecko/32.0 Firefox/32.0

Notes:
Repro frequency: 100%
Link to failed test case: https://moztrap.mozilla.org/manage/cases/?filter-id=7889
See attached screenshot and logcat logs
Repros on Open C 2.0, Flame 1.4, Buri 1.4 mozilla RIL and Buri 1.3 mozilla RIL.

Open C 2.0
Build ID: 20140530040207
Gecko: https://hg.mozilla.org/mozilla-central/rev/e6f113c83095
Gaia: 26d8fcab9b61f46451600f39c51e0387ef3c4f88
Platform Version: 32.0a1
Firmware Version: P821A10v1.0.0806_LOG_DL
User Agent: Mozilla/5.0 (Mobile; rv:32.0) Gecko/32.0 Firefox/32.0

Flame 1.4
Build ID: 20140530000202
Gecko: https://hg.mozilla.org/releases/mozilla-b2g30_v1_4/rev/25011f9a8f26
Gaia: fe612fd21389193a8e593aa718831602e5086a62
Platform Version: 30.0
Firmware Version: V10g-2
User Agent: Mozilla/5.0 (Mobile; rv:30.0) Gecko/30.0 Firefox/30.0

Buri 1.4
Build ID: 20140530000202
Gecko: https://hg.mozilla.org/releases/mozilla-b2g30_v1_4/rev/25011f9a8f26
Gaia: fe612fd21389193a8e593aa718831602e5086a62
Platform Version: 30.0
Firmware Version: V1.2-device.cfg
User Agent: Mozilla/5.0 (Mobile; rv 30.0) Gecko/30.0 Firefox/30.0

Buri 1.3
Build ID: 20140530024008
Gecko: https://hg.mozilla.org/releases/mozilla-b2g28_v1_3/rev/57cd741e4d0b
Gaia: 5bd226b03a2d63dfe9df204f7c0afb9984e8fd42
Platform Version: 28.0
Firmware Version: V1.2-device.cfg
User Agent: Mozilla/5.0 (Mobile; rv:28.0) Gecko/28.0 Firefox/28.0
We're not sorting anything in the SMS app, the Contacts API is sorting for us... except we don't use "sortBy" at all, so maybe we should.

Omega, Jenny, can you confirm the expectation here?
Flags: needinfo?(ofeng)
Flags: needinfo?(jelee)
Search result should be sorted alphabetically. 
Julien, do you know who's in charge of contacts API? We probably need to talk about the sorting mechanism in detail. Tks!
Flags: needinfo?(ofeng)
Flags: needinfo?(jelee)
I'm part of the Contacts API team ;) but I think we need to try to use "sortBy" already because it's already part of the API but we don't use it.

Should we sort by first name or by last name? (I'd say first name because we show the first name first)
Flags: needinfo?(jelee)
I'm not an expert on sorting algorithm ;) but I think it makes sense to sort by first name first (followed by the second letter of the first name, then the third letter, and so on so forth), then show the last names. For example, search result for "a" would be: 

1.Adam Richard ("Ad"am comes before "Al"ex)
2.Alex Ryan ("R"yan comes before "S"mith)
3.Alex Smith
4.Gregory Adon ("Ad"on comes before "Al"bert)
5.Henry Adon ("G"regory comes before "H"enry)
6.Emily Albert

Search result for "ad" would be:
1.Adam Richard 
2.Gregory Adon ("G"regory comes before "H"enry) 
3.Henry Adon 

We can discuss more about this if there's any case missing here, tks!
Flags: needinfo?(jelee)
Jenny, I was just thinking, wouldn't we want to have it ordered by use count?

I mean, if I send messages very often to Gregory Adon, shouldn't he appear first in the list ?

If we have no information for a contact, then it would be alphabetical (and so we can start by doing this here).
Flags: needinfo?(jelee)
I'd say it would be even more useful because when pressing "enter" the first suggestion is used.
(In reply to Julien Wajsberg [:julienw] from comment #7)
> Jenny, I was just thinking, wouldn't we want to have it ordered by use count?
> 
> I mean, if I send messages very often to Gregory Adon, shouldn't he appear
> first in the list ?

I love the idea of providing the most frequently used list! However, I'm assuming if you message very often to Gregory Adon, you'd probably keep using the same message thread instead of starting a new message everytime? Also even if you start a new message to Adon, this new message would be merged to the old thread. So naturally, next time you start a new message, you'd be texting someone else. Does that make sense?
Flags: needinfo?(jelee)
Ok, let's say:
* you write a lot to John Smith -> his thread is probably the first one in the list, and you'll use this thread to write him
-> this works with what you say.

Now:
* you write to Gregory Adon, but not so much, so you his thread is "somewhere" near the top, but it could be in the second page already (because closer to the top, you'd have your father, your mother, your brother, other friends..)

So, you want to write to your good friend Gregory Adon, maybe the first contact that has a "a" in his name, most probably the first contact that has "ad" in his name. Finding his thread is painful, because it's "somewhere". So you'll go on New message, type "ad" to find him. But here that's still painful, because the first result is "Adam Richard", even though you didn't write to this guy for ages, and you can't just type "Enter" to just add "Gregory Adon".

What do you think ? :)

(note: this is actually a use case I have with my personal use of the phone; we could try to arrange a user testing session with other dogfooders)
NI Jenny for comment 10
Flags: needinfo?(jelee)
(In reply to Julien Wajsberg [:julienw] from comment #10)

> Now:
> * you write to Gregory Adon, but not so much, so you his thread is
> "somewhere" near the top, but it could be in the second page already

Ya I actually thought about this use case, and also when sending group message where this feature can be most helpful. The feature you proposed would perfectly support these use cases.
 
> So you'll go on New message, type "ad" to find him. But here that's still
> painful, because the first result is "Adam Richard", even though you didn't
> write to this guy for ages, and you can't just type "Enter" to just add
> "Gregory Adon".

If you are trying to search for "Gregory Adon" you'd probably use the keyword "Gr" instead of "Ad"? This would actually be inconvenient for those who used "Ad" though. 

My only concern for this feature is that there's limited space for showing search suggestions, we can display 2-3 results at the same time right now. As you mentioned above, there's still a great chance for user to message random people (mom, dad, other friends), so when searching, the frequently used ones will always be on top (if the keyword matches) and forces user to scroll down to look for the person he's trying to message now.  
      
Do you have any idea of how are we going to manage the use count? Do we show the contact that user has only messaged once before on our frequently used suggestion list? I'm thinking we can probably do something like "show only 2 matching results that has the highest use count" on top of the list, followed by the list that's sorted alphabetically. Let me know what you think ;)
Flags: needinfo?(jelee)
QA Whiteboard: [QAnalyst-Triage?]
Flags: needinfo?(ktucker)
Whiteboard: [2.0-flame-test-run-1] → [2.0-flame-test-run-1], [2.0-flame-test-run-2]
QA Whiteboard: [QAnalyst-Triage?] → [QAnalyst-Triage+]
Flags: needinfo?(ktucker)
QA Whiteboard: [QAnalyst-Triage+] → [QAnalyst-Triage+][lead-review+]
(In reply to Jenny Lee from comment #12)
> (In reply to Julien Wajsberg [:julienw] from comment #10)
> 
> > Now:
> > * you write to Gregory Adon, but not so much, so you his thread is
> > "somewhere" near the top, but it could be in the second page already
> 
> Ya I actually thought about this use case, and also when sending group
> message where this feature can be most helpful. The feature you proposed
> would perfectly support these use cases.
>  
> > So you'll go on New message, type "ad" to find him. But here that's still
> > painful, because the first result is "Adam Richard", even though you didn't
> > write to this guy for ages, and you can't just type "Enter" to just add
> > "Gregory Adon".
> 
> If you are trying to search for "Gregory Adon" you'd probably use the
> keyword "Gr" instead of "Ad"? This would actually be inconvenient for those
> who used "Ad" though. 

It was only an example :)
Say someone writes a lot to "Julien Wajsberg" but he has "Julien Adon" and "Julien Richard" and "Julien Smith" in his contacts. "Julien Wajsberg" would always be last if we alphabetically sort.


> 
> My only concern for this feature is that there's limited space for showing
> search suggestions, we can display 2-3 results at the same time right now.
> As you mentioned above, there's still a great chance for user to message
> random people (mom, dad, other friends), so when searching, the frequently
> used ones will always be on top (if the keyword matches) and forces user to
> scroll down to look for the person he's trying to message now.  

You're right. As a data point, my own use is:
1. type ~3 first letters
2. try to find the match

We could think that I could simply add a 4th letter, but since the 3 first letters usually make me find the contact, it's just an habit I have now.

So yeah, I definitely agree with you here.

>       
> Do you have any idea of how are we going to manage the use count? Do we show
> the contact that user has only messaged once before on our frequently used
> suggestion list?

I think we can do whatever you want here. If you want to put only users that have more than (say) 2 or 3 uses, we can do this. But I think I'd prefer to just show the most frequent on top, even if it's only 1 use, and alphabetically sort them if they have the same usage count.

> I'm thinking we can probably do something like "show only 2
> matching results that has the highest use count" on top of the list,
> followed by the list that's sorted alphabetically. Let me know what you
> think ;)

I think this is a great idea. With the additional rule: if the 2nd "frequent" has the same usage count than the 3rd "frequent", then we would remove it from the list of frequent. Same if the 1st and 2nd have the same usage count than the 3rd. (and in that case the list would simply be alphabetically sorted).

Another latest question: do you think this should be shared with other apps? Say, if a contact is frequent in the Messages app, should it be frequent in the E-Mail app as well? Or maybe it does not make sense because as a user we usually send messages to the same contacts in one way, and to other contacts in another way.

I'm happy because all this looks good!
Flags: needinfo?(jelee)
Hi Julien,

Not sure if you still remember the video I showed you about iPhone Hangout behavior, they have this design that when amount of contact suggestions exceeds the display area of completion panel, scrolling on the area would make keyboard collapse and completion panel expands, so that user can see more results. I think this is really nice and have added this particular behavior to the coming spec. (I know we haven't discussed this, so feel free to voice your concern if any ;) 
 
With that being said, I've been rethinking this limit to 2 frequent user rule. If we have (almost) the whole screen to display contact suggestions, we probably won't need the limitation. So the rule would simply be: For any given search term, show the most used contact on top, followed by second most used contact and so on so forth. If multiple contacts have the same use count, display them by alphabetical order.

Does that sound good to you?
Flags: needinfo?(jelee)
It sounds good.

I'm only worried by the performance while hiding the keyboard (remember we resize the app when this happens... until bug 1025672 is resolved) and scrolling. But since scrolling happens in another thread, it might work fine. We need to test.
This could be a great bug for a contributor.
Mentor: felash
Summary: [B2G] [Messaging] Contact search results are not shown in alphabetical order → [Messages] When showing the suggestions list, order by most used contacts first, then order by alphabetical order
Whiteboard: [2.0-flame-test-run-1], [2.0-flame-test-run-2] → [2.0-flame-test-run-1], [2.0-flame-test-run-2][sms-papercuts][lang=js]
Mass closing of Gaia::SMS bugs. End of an era :(
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Mass closing of Gaia::SMS bugs. End of an era :(
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: