Update change log and spec for wrt-plugins-tizen_0.4.50
[framework/web/wrt-plugins-tizen.git] / src / Contact / PersonSearchEngine.cpp
index 3d2bc3a..47a641f 100755 (executable)
@@ -196,6 +196,9 @@ void PersonSearchEngine::visitAttribute(string& attrName, MatchFlag& matchFlag,
        int errorCode = 0;
        contacts_filter_h filter = NULL;
 
+       if(matchValue == NULL || matchValue->isNullOrUndefined())
+               matchFlag = MATCH_EXISTS;
+
        if(depth != 0)
        {
                filter = m_filterStack.top();
@@ -214,11 +217,15 @@ void PersonSearchEngine::visitAttribute(string& attrName, MatchFlag& matchFlag,
                int value = 0;
                if(attrName == "id" || attrName == "displayContactId")
                {
-                       string valueStr = matchValue->getString();
-                       value = ContactUtility::strToInt(valueStr);
+                       if(matchFlag != MATCH_EXISTS){
+                               string valueStr = matchValue->getString();
+                               value = ContactUtility::strToInt(valueStr);
+                       }
+               }
+               else{
+                       if(matchFlag != MATCH_EXISTS)
+                               value = matchValue->getLong();
                }
-               else
-                       value = matchValue->getLong();
 
                contacts_match_int_flag_e flag;
                if(matchFlag == MATCH_EXISTS)
@@ -238,10 +245,13 @@ void PersonSearchEngine::visitAttribute(string& attrName, MatchFlag& matchFlag,
        else if(property.type == PrimitiveType_String)
        {
                string value;
-               if(attrName == "photoURI" || attrName == "ringtoneURI")
-                       value = ContactUtility::convertUriToPath(matchValue->getString());
-               else
-                       value = matchValue->getString();
+               if(matchFlag != MATCH_EXISTS){
+                       if(attrName == "photoURI" || attrName == "ringtoneURI")
+                               value = ContactUtility::convertUriToPath(matchValue->getString());
+                       else
+                               value = matchValue->getString();
+               }else
+                       value = "";
 
                contacts_match_str_flag_e flag = CONTACTS_MATCH_EXISTS;
                if(matchFlag == MATCH_EXACTLY)
@@ -261,12 +271,9 @@ void PersonSearchEngine::visitAttribute(string& attrName, MatchFlag& matchFlag,
        }
        else if(property.type == PrimitiveType_Boolean)
        {
-               bool value = false;
-               value = matchValue->getBool();
-
-               // TODO MATCH_EXISTS
-//             if(matchFlag == MATCH_EXISTS)
-//             else
+               bool value = true;
+               if(matchFlag != MATCH_EXISTS)
+                       value = matchValue->getBool();
 
                errorCode = contacts_filter_add_bool(filter, property.propertyId, value);
        }