Comment 53 for bug 956618

Revision history for this message
In , Bugzilla2007 (bugzilla2007) wrote :

(In reply to Thomas D. from comment #50)
> This looks like one of the main places where we call addToResult(...)
> function (see comment 49).
> If that's correct, one way of fixing this bug might be this:
>
> Around here...
>
> http://mxr.mozilla.org/comm-central/source/mailnews/addrbook/src/
> nsAbAutoCompleteSearch.js#146
> 146 let email = card.primaryEmail;
> 147 if (email)
> 148 this._addToResult(commentColumn, directory, card, email,
> true, result);
>
> ...perhaps we could get the nick field as we now get the email field, and
> then add matches of the search fullstring (is that available here?)

fullString (user's search words) are not explicitly available here (only inside the searchQuery argument which is passed to _searchCards function); but I suppose we could easily make it explicitly available by just passing it as a separate argument into _searchCards function:

http://mxr.mozilla.org/comm-central/source/mailnews/addrbook/src/nsAbAutoCompleteSearch.js#131
> _searchCards: function _searchCards(searchQuery, directory, result) {
-> _searchCards: function _searchCards(searchQuery, fullSearchString, directory, result) {

So then when we call that function, we can just pass fullstring, too:
http://mxr.mozilla.org/comm-central/source/mailnews/addrbook/src/nsAbAutoCompleteSearch.js#433
> this._searchCards(searchQuery, dir, result);
> this._searchWithinEmails(emailSearchQuery, fullString, dir, result);
-> this._searchCards(searchQuery, fullString, dir, result);

> against
> nick to a separate result array, say resultTop.
> Then merge resultTop Array with result array.
>
> We also need to sort multiple nick matches on something (because
> unfortunately it's possible to have multiple cards with same nick).

Perhaps we can get away with the current sorting algorithm of _addToResult.