[Kde-pim] Address Query with ContactSearchJob in KDE 4.13.0

Daniel Vrátil dvratil at redhat.com
Mon Apr 28 08:17:19 BST 2014


On Saturday 26 of April 2014 13:44:03 Klaas Freitag wrote:
> Hi,
> 
> as you might know my project Kraft [1] integrates with the KDE
> addressbook tightly, which is a highly appreciated feature by the users
> of Kraft.
> 
> Kraft uses the Akonadi::ContactSearchJob to query the addressbooks by UID.
> 
> Today I updated to KDE 4.13.0 and found that the query is not longer
> working, the search result list is always empty. We had that in the
> past, but often it helped to switch on the Nepomuk Indexing on PIM data.
> Now that we do not use Nepomuk any more I wonder how that works now.
> 
> Here is a little test program called findcontact which can be used to
> query for a contact:
> https://projects.kde.org/projects/playground/office/kraft/repository/revisio
> ns/aed27bf3a54eec46d8ac330df95b579439c48151/entry/tools/findcontact.cpp
> 
> and this is what I see in the akonadiconsole debugger when query for an
> existing address via UID:
> 
> ===>
> 0x12f3980 * OK Akonadi Almost IMAP Server [PROTOCOL 37]
> 0x13bc1d0 * OK Akonadi Almost IMAP Server [PROTOCOL 37]
> 0x12f3980 0 LOGIN "-924859463"
> -924859463 (0x12f3980) 0 OK User logged in
> 0x13bc1d0 0 LOGIN "-924859463-SearchSession"
> -924859463-SearchSession (0x13bc1d0) 0 OK User logged in
> -924859463 (0x12f3980) 1 CAPABILITY (NOTIFY 3 NOPAYLOADPATH
> AKAPPENDSTREAMING SERVERSEARCH)
> -924859463 (0x12f3980) 1 OK CAPABILITY completed
> -924859463-SearchSession (0x13bc1d0) 1 CAPABILITY (NOTIFY 3
> NOPAYLOADPATH AKAPPENDSTREAMING SERVERSEARCH)
> -924859463-SearchSession (0x13bc1d0) 1 OK CAPABILITY completed
> -924859463-SearchSession (0x13bc1d0) 2 SEARCH MIMETYPE (text/directory)
> QUERY "{ \"limit\" : 1, \"negated\" : false, \"rel\" : 1, \"subTerms\" :
> [ { \"cond\" : 0, \"key\" : \"uid\", \"negated\" : false, \"value\" :
> \"Kp9LZPRW8P\" } ] }" FULLPAYLOAD EXTERNALPAYLOAD (UID COLLECTIONID
> FLAGS SIZE REMOTEID REMOTEREVISION DATETIME)
> -924859463-SearchSession (0x13bc1d0) 2 OK Search done
> <===
> 
> I swear that a contact with UID Kp9LZPRW8P exists in a local addressbook ;-)

Hi,

Baloo does not index contact UID, so you won't get any matches :-)

If you only want to search by UID, you can use GID fetch. GID is identifier of 
content of the item (UID for vCards, UID for iCals, Message-Id for emails, 
etc), which is stored directly in Akonadi.

You can use regular ItemFetchJob to fetch items by GID:

Item item;
item.setGid("Kp9LZPRW8P");
ItemFetchJob *fetch = new ItemFetchJob(item, this);
...
...

Since GID is not guaranteed to be unique, you might want to use 
fetch->setCollection() to specify from which collection to fetch (it also 
speeds up the lookup a lot) if you work only with one collection.

Dan

> 
> I'd appreciate any hints on how this problem could be solved, for me to
> improve Kraft and for Kraft's users who are often non tech people who
> get into trouble if they update to a more recent KDE version and see
> this breaking, as they fear to be not longer able to send out invoices.
> That is a uncomfortable situation for them which makes them quickly
> running away ;-)
> 
> If that is a problem like "baloo does not have this functionality yet"
> its fine but than I would like to inform Krafts user to _not_ update yet.
> 
> Thanks for your help & and the great improvements recently,
> 
> Klaas
> 
> 
> [1] http://volle-kraft-voraus.de
> _______________________________________________
> KDE PIM mailing list kde-pim at kde.org
> https://mail.kde.org/mailman/listinfo/kde-pim
> KDE PIM home page at http://pim.kde.org/

-- 
Daniel Vrátil | dvratil at redhat.com | dvratil on #kde-devel, #kontact, #akonadi
KDE Desktop Team
Associate Software Engineer, Red Hat, Inc.

GPG Key: 0xC59D614F6F4AE348
Fingerprint: 4EC1 86E3 C54E 0B39 5FDD B5FB C59D 614F 6F4A E348
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20140428/4a3d0384/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list