From: Piotr Kosko
Date: Fri, 12 Jun 2015 11:09:57 +0000 (+0200)
Subject: [Content] Fix for content_filter "CONTAINS", "STARTSWITH", "ENDSWITH"
X-Git-Tag: submit/tizen/20150702.103311^2~2^2~53^2
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=600f1300006925920deb3745417439ed978c47fc;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Content] Fix for content_filter "CONTAINS", "STARTSWITH", "ENDSWITH"
[Bug] Support for "CONTAINS", "STARTSWITH", "ENDSWITH" match flags was missing.
[Verification] TCT passrate 100%.
Change-Id: I709fca1587ac226c9e369824044a2338ce2ea727
Signed-off-by: Piotr Kosko
---
diff --git a/src/content/content_filter.cc b/src/content/content_filter.cc
index 930d5061..132e6f8e 100755
--- a/src/content/content_filter.cc
+++ b/src/content/content_filter.cc
@@ -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("\"");
}