[dev] Turba API search()

Michael J Rubinsky mrubinsk at horde.org
Wed Jun 8 16:25:01 UTC 2016


Quoting Michael J Rubinsky <mrubinsk at horde.org>:

> Quoting Sebastian Birnbach <birnbacs at gmail.com>:
>
>> I am working on a Block that will output certain address book information.
>> I have trouble restricting the search to certain fields, namely the
>> "company" field.
>>
>>
>> [...]
>>    $terms = array($this->_params['search']);
>>
>>    $options = array(
>>        'count_only' => false,
>>        'fields' => array('company')
>>    );
>>
>>    $res = $registry->contacts->search($terms, $options);
>> [...]
>>
>> This returns all persons with the search string in any searchable field, be
>> it "company" or "name".
>>
>>
>> I enclose the Block lib/Block/Contacts.php for better reproducability, call
>> it from any wiki page with this code:
>>
>> [[block horde/Contacts search=string]]
>>
>>
>>
>> Any clues anybody?
>
> Looks like the API method is expecting the 'fields' array to be  
> keyed by the source you are searching (since the search method can  
> also take an array of sources to search). I'll have a fix shortly.

https://github.com/horde/horde/commit/7c4ec133547f6fc8c071a72c7c0762f77b053857


>
>
>> Kind regards
>>
>>  Sebastian
>
>
>
> -- 
> mike
> The Horde Project
> http://www.horde.org
> https://www.facebook.com/hordeproject
> https://www.twitter.com/hordeproject



-- 
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5751 bytes
Desc: S/MIME Signature
URL: <https://lists.horde.org/archives/dev/attachments/20160608/f4e90bec/attachment.bin>


More information about the dev mailing list