From 01daea0c1329e077c0faaf2b234db8c33ac38811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 21 Dec 2011 17:30:48 +0100 Subject: [PATCH] fallback in contact indexer --- themis/search/indexer.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/themis/search/indexer.py b/themis/search/indexer.py index e1b9d77..4e24f3c 100644 --- a/themis/search/indexer.py +++ b/themis/search/indexer.py @@ -153,7 +153,10 @@ def contactIndexer(obj): v = v[0] if ':' in v: src = ContactsSource() - r = src.fastGetTitleByToken(obj, v) + try: + r = src.fastGetTitleByToken(obj, v) + except KeyError: + continue if not type(r) is unicode: r = unicode(r, 'utf-8') return r @@ -176,7 +179,10 @@ def contactFuzzyIndexer(obj): v = v[0] if ':' in v: src = ContactsSource() - r = src.fastGetTitleByToken(obj, v) + try: + r = src.fastGetTitleByToken(obj, v) + except KeyError: + return v.split(':')[1:] if not type(r) is unicode: r = unicode(r, 'utf-8') return r