[Content] Fix for content_filter "CONTAINS", "STARTSWITH", "ENDSWITH"
authorPiotr Kosko <p.kosko@samsung.com>
Fri, 12 Jun 2015 11:09:57 +0000 (13:09 +0200)
committerPiotr Kosko <p.kosko@samsung.com>
Fri, 12 Jun 2015 11:13:08 +0000 (13:13 +0200)
[Bug] Support for "CONTAINS", "STARTSWITH", "ENDSWITH" match flags was missing.

[Verification] TCT passrate 100%.

Change-Id: I709fca1587ac226c9e369824044a2338ce2ea727
Signed-off-by: Piotr Kosko <p.kosko@samsung.com>
src/content/content_filter.cc

index 930d506..132e6f8 100755 (executable)
@@ -142,7 +142,19 @@ PlatformResult ContentFilter::BuildQuery(const picojson::object& jsFilter,
           matchValue = "4";
         }
       }
-      query += matchValue;
+      switch (match_flag) {
+        case AttributeMatchFlag::kStartsWith :
+          query += matchValue + "%";
+          break;
+        case AttributeMatchFlag::kEndsWith :
+          query += "%" + matchValue;
+          break;
+        case AttributeMatchFlag::kContains :
+          query += "%" + matchValue + "%";
+          break;
+        default :
+          query += matchValue;
+      }
       query.append("\"");
     }