Closed
Bug 731406
Opened 13 years ago
Closed 13 years ago
Contacts API: Incremental Search
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla14
People
(Reporter: gwagner, Assigned: gwagner)
References
Details
Attachments
(1 file, 3 obsolete files)
17.32 KB,
patch
|
bent.mozilla
:
review+
|
Details | Diff | Splinter Review |
Right now we have to iterate over all Contacts to perform incremental search.
The idea is to add a searchable field once we put a contact into the DB that allows to find the contact even with substrings.
For example "Tom" should be a findable with "t, to, tom, T, To, Tom"
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → anygregor
Assignee | ||
Comment 1•13 years ago
|
||
I added a search property to the contact in the DB that saves the text incrementally.
For example:
Something like: {givenName: "Tom", familyName: "Test"});
results in a DB object that looks like
properties: "givenName":["Tom"],"familyName":["Test"]
search: "givenName":["t","to","tom"],"familyName":["t","te","tes","test"]
I don't think it makes much sense to add a case sensitive incremental search.
Assignee | ||
Comment 2•13 years ago
|
||
Attachment #603480 -
Attachment is obsolete: true
Assignee | ||
Comment 3•13 years ago
|
||
Attachment #603481 -
Attachment is obsolete: true
Attachment #603489 -
Flags: review?(bent.mozilla)
You don't need to add multiple entries if you want to do just "prefix searching".
If someone searches for 't', just create a keyrange like
x = 't';
range = IDBKeyRange.bound(x, x + "\uFFFF");
That range will return all strings starting with 't'. Likewise if you set x to 'to' it'll find all strings starting with 'to'.
You will need to store a case-folded string though if you want case insensitive search. And do something like:
x = 'tO';
x = x.toLowerCase();
range = IDBKeyRange.bound(x, x + "\uFFFF");
Assignee | ||
Comment 5•13 years ago
|
||
Attachment #603489 -
Attachment is obsolete: true
Attachment #603489 -
Flags: review?(bent.mozilla)
Assignee | ||
Updated•13 years ago
|
Attachment #603803 -
Flags: review?(bent.mozilla)
Comment on attachment 603803 [details] [diff] [review]
patch
Review of attachment 603803 [details] [diff] [review]:
-----------------------------------------------------------------
Looks great!
::: dom/contacts/fallback/ContactDB.jsm
@@ +362,5 @@
> if (key == "id") {
> // store.get would return an object and not an array
> request = store.getAll(options.filterValue);
> } else {
> + if (options.filterOp == "equals") {
Nit: could do 'else if' here
@@ +370,5 @@
> + request = index.getAll(options.filterValue, options.filterLimit);
> + } else {
> + // not case sensitive
> + let tmp = options.filterValue.toLowerCase();
> + var range = this._global.IDBKeyRange.bound(tmp, tmp + "\uFFFF");
Nit: I'd consistently use 'let' here.
Attachment #603803 -
Flags: review?(bent.mozilla) → review+
Assignee | ||
Comment 7•13 years ago
|
||
Updated•13 years ago
|
Target Milestone: --- → mozilla14
Comment 8•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Comment 9•12 years ago
|
||
Hi,
I wanted to report bug that TB can't seach based on second word in name, lastname or email fileds.
For example
Name: John Mary
Lastname: Smith
Email: john.mary.smith@email.com
If you search by "mary" TB will find nothing since that word is second in name field and not first in email field.
Did solving this bug fixed this also?
I'm using TB 10 ESR, not TB 14 so I cannot test it right now.
This bug has nothing to do with Thunderbird. Please file a bug in the Thunderbird product or visit https://support.mozillamessaging.com/
Comment 11•12 years ago
|
||
Sorry, was doing search trought "file new bug" for Thunderbird and this came up.
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•