Re: ACTION-19 contact api review / feedback

On 9.10.2009, at 17.12, ext richard.tibbett@orange-ftgroup.com wrote:

> On 7th Oct, 2009 10:41am, anssi.kostiainen@nokia.com wrote:
>> I'd also add:
>>
>> MAY provide an interface to search through contacts.
>
> Taking the use cases from my previous email and with the assumption  
> that
> 'within each Contact object the fields are ANDed' and 'between Contact
> objects the fields are ORed' then this could be accomplished using
> sequences of ContactFilter objects as follows:
>
> 1. Filter contacts that are in my ('friends' OR 'collegues') group AND
> are based in the 'UK'.
>
> var search = {
>                 { category: 'friends', country: 'uk' },
>                 { category: 'colleagues', country: 'uk' }
>             };
>
> /*...*/device.contacts.addressbook.find(search);
>
> 2. Search for the entered query string 'london' over any of the
> following contact attributes: 'firstname', 'lastname', 'address',  
> 'job'
> and return all matching results.
>
> var search = {
>                 { firstname: 'london' },
>                 { lastname: 'london' },
>                 { address: 'london' },
>                 { job: 'london' }
>             };
>
> /*...*/device.contacts.addressbook.find(search);
>

Looks like a fairly intuitive subset of a JavaScript-ish query  
language. Granted, it's easy to start sliding into the direction of  
specifying a full-blown query language but let's stop here. I feel the  
proposal above (=support for AND and OR operators) fulfills the  
following requirement by striking a balance between simplicity and  
functionality (perhaps a bit on the expense of extensibility):

"SHOULD enable filtering the list of contacts to search for a subset"

Btw. I assume the search variable should be of type Array in the above  
examples?

> Does that provide the search feature required? This would denote only
> the following minimal change to the existing Contacts API WebIDL (plus
> some descriptive text):
>
> [NoInterfaceObject]
> interface AddressBook {
>    ...
>    sequence<Contact> find (in Object filter);
> };
>

The find method should perhaps be described as something like  
(reflecting the latest Contacts API ED):

sequence<Contact> find (in sequence<ContactFilter> filters);

-Anssi

Received on Tuesday, 13 October 2009 14:00:59 UTC