Closed Bug 857832 Opened 12 years ago Closed 12 years ago

[music] Search functionality doesn't find Mötley Crüe

Categories

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

ARM
Gonk (Firefox OS)
defect
Not set
major

Tracking

(blocking-b2g:leo+, b2g18 fixed)

RESOLVED FIXED
blocking-b2g leo+
Tracking Status
b2g18 --- fixed

People

(Reporter: marcia, Assigned: mihai)

References

()

Details

(Whiteboard: mentoredbug mentor=squib)

Attachments

(1 file)

unagi, while running Mozilla RIL using: Gecko http://hg.mozilla.org/releases/mozilla-b2g18/rev/d467369d1b0c Gaia 06e0e5ce42bdfb62bdbe38271de6b5b2d9e40e75 BuildID 20130403070204 Version 18.0 STR: 1. Load some Mötley Crüe songs on your phone 2. Invoke the search feature and type "motley" Expected: Search would find motley Actual: Search doesn't find motley presumable due to umlauts?
Assignee: nobody → squibblyflabbetydoo
blocking-b2g: leo? → leo+
As far as I'm aware, there's not an easy way to strip diacritics from strings to compare like this. Besides that, it's not always clear what the conversion should be. "Rock dots", since they're just for show, obviously map to the unaccented character, but a German would be surprised by that, since in German, "ö" == "oe".
Question: do we do anything like this in other search contexts, e.g. contacts?
(In reply to Jim Porter (:squib) from comment #2) > Question: do we do anything like this in other search contexts, e.g. > contacts? To answer my own question: we do. Although I'm not sure how contacts does this yet.
Whiteboard: mentoredbug mentor=squib
Jim, are you currently working on this? If not, I would like to take it -- I was thinking of a quick fix involving string normalization (i.e. "ö" -> "o").
Flags: needinfo?(squibblyflabbetydoo)
Go for it. I recommend looking in the communications app, which already does this normalization. I was planning on adding some common code in /shared/js/ for this.
Flags: needinfo?(squibblyflabbetydoo)
(In reply to Jim Porter (:squib) from comment #5) > Go for it. I recommend looking in the communications app, which already does > this normalization. I was planning on adding some common code in /shared/js/ > for this. Thanks for the hints, I was checking the search implementation for the Contacts app and noticed this normalization approach.
Assignee: squibblyflabbetydoo → mihai
When performing a search, treat commonly used accented chars as their ASCII equivalents (i.e. 'ö' -> 'o'), thus finding artists like 'Mötley Crüe' with ASCII type queries like 'motley'.
Attachment #747371 - Flags: review?(dkuo)
Comment on attachment 747371 [details] Pull Request #9641 - Normalize search strings Mihai, I took a quick look on your patch, not in detail yet because I found you have implemented a different normalizer for Music, comparing to Contacts app. As Jim said in Comment 5, /shared/js will be a good place to put codes like the normalizer utility, so if your normalizer works well then we should put in it /shared/js for the other apps to use, and try to keep all the normalize logics the same since Music is not the only one which uses normalizer. For fixing this issue, I think at least you should try: 1. Put your normalizer in /shared/js, use it in Music and also modify Contacts to use it(or file a bug for Contacts). or 2. Move the normalizer.js from Contacts to /shared/js and use it in both Contacts and Music. It depends on which implementation is correct/better. Please address these issues and I will review your revised patch, thanks.
Attachment #747371 - Flags: review?(dkuo)
(In reply to Dominic Kuo [:dkuo] from comment #8) > Comment on attachment 747371 [details] > Pull Request #9641 - Normalize search strings > > Mihai, > > I took a quick look on your patch, not in detail yet because I found you > have implemented a different normalizer for Music, comparing to Contacts > app. As Jim said in Comment 5, /shared/js will be a good place to put codes > like the normalizer utility, so if your normalizer works well then we should > put in it /shared/js for the other apps to use, and try to keep all the > normalize logics the same since Music is not the only one which uses > normalizer. > > For fixing this issue, I think at least you should try: > > 1. Put your normalizer in /shared/js, use it in Music and also modify > Contacts to use it(or file a bug for Contacts). or > 2. Move the normalizer.js from Contacts to /shared/js and use it in both > Contacts and Music. > > It depends on which implementation is correct/better. > > Please address these issues and I will review your revised patch, thanks. Hi Dominic, thanks for taking a look at my patch, I also found normalizer.js from Contacts, but it doesn't seem quite complete in terms of accented chars: for example, 'ț' and 'ș', specific for Romanian (v1.0.1 language), are not there and thus will not be normalized. Moreover it defines an object of the form utils.text._ that also includes escapeHTML() as a function, which from what I noticed is implemented/copied in every app that uses it. I'm thinking a good approach would be to combine normalizer.js with my implementation in shared/js, but I'm not sure how to go about naming: should I keep the utils.text._ structure or just name it Normalizer? Regarding the use of the shared/js solution in Contacts, I will simply file a new bug about it once I get your input on this. Thanks!
Flags: needinfo?(dkuo)
(In reply to Mihai Cirlanaru [:mcirlanaru] from comment #9) > Hi Dominic, thanks for taking a look at my patch, I also found normalizer.js > from Contacts, but it doesn't seem quite complete in terms of accented > chars: for example, 'ț' and 'ș', specific for Romanian (v1.0.1 language), > are not there and thus will not be normalized. Yes, so go ahead to implement a more complete normalizer. > Moreover it defines an object of the form utils.text._ that also includes > escapeHTML() as a function, which from what I noticed is implemented/copied > in every app that uses it. Actually if you assign your original text to an temporary element, using element.textContent then gecko will escape for you so that you don't have to write your own escapeHTML(). > I'm thinking a good approach would be to combine normalizer.js with my > implementation in shared/js, but I'm not sure how to go about naming: should > I keep the utils.text._ structure or just name it Normalizer? I think normalizer(or text_normalizer) will be fine, the utils.text._ structure is only used in communications apps, I am not sure why that happens because window.utils seems not a standard(I cannot find any documents on MDN), so a clear filename with easy-to-understand code comments will be enough.
Flags: needinfo?(dkuo)
Comment on attachment 747371 [details] Pull Request #9641 - Normalize search strings Thanks for the suggestions, Dominic! I refactored the code, extended the map of accented-form characters to be exhaustive (i.e. include all existing such chars), created the shared text_normalizer.js in shared/js, and included the new normalizer in the Music app search functionality. Once I get your approval on these changes, I will file a bug to use the new normalizer in Contacts as well.
Attachment #747371 - Flags: review?(dkuo)
Mihai, I found there is an latin equivalentChars mapping table which I am not familiar with, so I have invited Rudy to help on reviewing your patch cause he works on keyboard app and I guess the mapping is copied from it. Let's do the technical parts on github.
(In reply to Dominic Kuo [:dkuo] from comment #12) > Mihai, > > I found there is an latin equivalentChars mapping table which I am not > familiar with, so I have invited Rudy to help on reviewing your patch cause > he works on keyboard app and I guess the mapping is copied from it. Let's do > the technical parts on github. Hi Dominic, the equivalent chars map I took from predictions.js (https://github.com/mozilla-b2g/gaia/blob/master/apps/keyboard/js/imes/latin/predictions.js#L211), since it seems to be the most complete list I could find. Looking forward to your review.
Dominic or Rudy, do you have time to take a look at this review?
Flags: needinfo?(rlu)
Hi Dylan, Sure, sorry this has been in my queue for a while. Will get to it in 1 or 2 hours. Thanks for the heads-up.
Flags: needinfo?(rlu)
Comment on attachment 747371 [details] Pull Request #9641 - Normalize search strings Looks good to me. There are some minor points commented on the pull request, but not blocking ones. Hi Mihai, Thanks for your great work.
Attachment #747371 - Flags: review?(dkuo) → review+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Uplifted 55b3f1629e0ea673b1d38b8b30274880264b7cf8 to: v1-train: d5de42c41805281d45defaf6699165253821dff7
Blocks: 880186
There is a performance follow up, please see bug 880186.
Flags: in-testsuite?
Flags: in-testsuite? → in-moztrap?
Flags: in-moztrap? → in-moztrap+
QA Contact: amiller
Blocks: 881904
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: