Closed Bug 852577 Opened 12 years ago Closed 6 years ago

Contacts API: support the "full name search" use case

Categories

(Core Graveyard :: DOM: Contacts, defect, P5)

22 Branch
ARM
Gonk (Firefox OS)
defect

Tracking

(b2g18-)

RESOLVED WONTFIX
Tracking Status
b2g18 - ---

People

(Reporter: julienw, Unassigned)

References

Details

Here is the use case : * we have a contact named "Julien Wajsberg" (givenName is "Julien", familyName is "Wajsberg"). * in the SMS app, we begin to write "Julien" => it returns correctly the number * then we go on "Julien " => currently, it returns nothing, because we search in each property separately * same with the full name, or with the inverted words The possible algorithm is to tokenize, if we have 3 words or more remove the words with 3 characters or less, search for each words, and return the intersection. Therefore, at the very least, it would be nice to give |find| a filter composed of several filters, with a modifier AND or OR. The best would be that the Contacts API implements this "sort of full text" algorithm itself.
Rob can you confirm if this is in the v1 specs?
Flags: needinfo?(rmacdonald)
For the record, we could do that without a change in the API, but this would make things easier.
lsblakk, Not sure if this is what you're looking for (or even helpful), but for some background I discovered this issue when I was writing tests for https://bugzilla.mozilla.org/show_bug.cgi?id=840073, which says "contact name". I conferred with Julien and he filed this ticket. Also of interest: https://www.dropbox.com/s/zc3hhd1mxi16p4w/MMS.pdf
"Julien " (with a space afterwards) should still show Julien Wajsberg and any other matches for Julien. Also, "Julien W" should show any matches for Julien Wajsberg and any other Juliens whose last name starts with "W". "Wajs" should also pull up "Julien Wajsberg" as well. I tried it in Contacts and it seems to work, however, from the SMS app, we get the error above.
Flags: needinfo?(rmacdonald)
In that case, I will take a look at the contacts app and apply the same lookup algorithm or API call, whatever the case may be. Thanks for the heads up
Reviewing the Contacts app's search, looks like the app is searching for contacts in the textNodes and dataset property values of the _rendered_ contacts list DOM tree. https://github.com/mozilla-b2g/gaia/blob/master/apps/communications/contacts/js/search.js#L304-L378 This isn't going to work for SMS.
Gregor, do you think we could have an API such as described in Comment 0 quite fast, or should we do that now in the app instead ? My gut tells me that we won't have this in time and that we need to do that in the app (in another bug) now but add a comment with this bug URL to change that later. This would also let us taking some time to really think of this peacefully ;)
Flags: needinfo?(anygregor)
I don't think we should count on quickly getting an API which allow more freeform searching. Doing that has a lot of tricky edge cases. I actually think that medium-term we need to move a lot of the responsibility for searching from the API and into the apps. There are just too many ways to filter and order for the API to be able to keep the necessary indexes in order to perform all searches that applications will want to do in a reasonably fast way. This stuff is definitely something that we should discuss between platform folks and gaia folks. But if you guys have a solution that you can crib from other apps, then I would say go for it.
(In reply to Julien Wajsberg [:julienw] from comment #7) > Gregor, do you think we could have an API such as described in Comment 0 > quite fast, or should we do that now in the app instead ? > > My gut tells me that we won't have this in time and that we need to do that > in the app (in another bug) now but add a comment with this bug URL to > change that later. This would also let us taking some time to really think > of this peacefully ;) If you mean in the next days, then no. A global search function is complicated and needs more discussion. If we need one, we should talk about it in Madrid.
Flags: needinfo?(anygregor)
I'm going to move forward with the patch I have baking for this
Assignee: nobody → waldron.rick
See Also: → 853788
Rick, I filed Bug 853788 to track the work in the Sms app. Let's keep this bug for the API work.
Assignee: waldron.rick → nobody
As this seems like a feature and it's a bit late in v1.1 for those we won't track this but if the work gets done anyway and there's a good risk vs. reward scenario on the uplift please renominate.
FYI Bug 853788 landed and has a tested algorithm to efficiently find contacts using multiple terms with the current contacts API. I'm quite sure the actual code could be imported/adapted into the Contacts API to fix this bug.
Component: DOM: Device Interfaces → DOM: Contacts
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
DOM: Contacts isn't used anymore. Closing all remaining bugs.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.