Closed Bug 909454 Opened 11 years ago Closed 9 years ago

Allow filters for mozContacts.getAll

Categories

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

x86
macOS
defect

Tracking

(tracking-b2g:backlog)

RESOLVED INVALID
tracking-b2g backlog

People

(Reporter: kgrandon, Unassigned)

References

Details

(Keywords: perf, Whiteboard: [c= p= s= u=])

Currently filters are only used for find() calls. We would really like to see filters for mozContacts.getAll for some performance investigation. This bug to see if it's possible and how much work that it would take to implement. For example, we are trying to make a call like: navigator.mozContacts.getAll({ sortBy: 'givenName', sortOrder: 'descending', filterBy: ['familyName'], filterValue: 'Z', filterOp: 'startsWith' });
Gregor - if you have any tips about where to get started with this it would be helpful. I might have someone on our team try to tackle this if you are busy. Thanks!
Flags: needinfo?(anygregor)
Component: Gaia::Contacts → DOM: Device Interfaces
Product: Boot2Gecko → Core
Kevin and I were looking at the code it appears this might work if we change nsIDOMContactManager.idl so that getAll() uses nsIContactFindOptions. This should allow the filter options to pass to getAll(), which will be applied during the non-cached query. Kevin just verified that this works in a modified firefox nightly and the simulator. One potential issue would be if we get too many cached results that never get cleaned up. Thoughts?
We should just limit the number of cache-entries and overwrite old values. Otherwise it should just work.
Flags: needinfo?(anygregor)
So you want find() with cursors? That should be simple, yes. Caching results keyed on the find options is going to be pretty much useless, though.
(In reply to Reuben Morais [:reuben] from comment #4) > So you want find() with cursors? That should be simple, yes. Caching results > keyed on the find options is going to be pretty much useless, though. Well, our thought was to all filtering options in getAll() instead of adding cursors to find(). The caching was only mentioned since getAll() does caching.
Sorry, to *add* filtering options to getAll().
Blocks: 909935
(In reply to Ben Kelly [:bkelly] from comment #5) > Well, our thought was to all filtering options in getAll() instead of adding > cursors to find(). The caching was only mentioned since getAll() does > caching. Without mentioning the obvious problem of appropriate naming, I don't like the idea of getAll having two very different (speed and memory usage) behaviors depending on what options are passed.
Keywords: perf
Whiteboard: [c= p= s= u=]
Component: DOM: Device Interfaces → DOM: Contacts
blocking-b2g: --- → backlog
Priority: -- → P3
blocking-b2g: backlog → ---
I think that this bug is no longer valid with the transition plan. Please re-open if you think we should still do this.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.