summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-06-05 16:13:34 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2018-06-05 16:13:34 +0200
commit4064c704f3e2877088f34125564a066bc8f1c979 (patch)
tree7c38ca6fe573681a178f1a08e348faf315155897 /container-search
parent7ae7c6d9b3ff6f80ecfb4f70b9fc3ac351196f90 (diff)
Verify that SameElementItem is not touched by query canonicalization.
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java b/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java
index 8bbe43ee3d4..e9267ff3c70 100644
--- a/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/yql/YqlParserTestCase.java
@@ -12,6 +12,7 @@ import com.yahoo.prelude.query.ExactStringItem;
import com.yahoo.prelude.query.Item;
import com.yahoo.prelude.query.PhraseItem;
import com.yahoo.prelude.query.PrefixItem;
+import com.yahoo.prelude.query.QueryCanonicalizer;
import com.yahoo.prelude.query.RegExpItem;
import com.yahoo.prelude.query.SegmentingRule;
import com.yahoo.prelude.query.Substring;
@@ -279,6 +280,10 @@ public class YqlParserTestCase {
"baz:{f1:a f2:10}");
assertParse("select foo from bar where baz contains sameElement(key contains \"a\", value.f2 = 10);",
"baz:{key:a value.f2:10}");
+ assertCanonicalParse("select foo from bar where baz contains sameElement(key contains \"a\", value.f2 = 10);",
+ "baz:{key:a value.f2:10}");
+ assertCanonicalParse("select foo from bar where baz contains sameElement(key contains \"a\");",
+ "baz:{key:a}");
}
@Test
@@ -936,6 +941,12 @@ public class YqlParserTestCase {
assertEquals(expectedQueryTree, parse(yqlQuery).toString());
}
+ private void assertCanonicalParse(String yqlQuery, String expectedQueryTree) {
+ QueryTree q = parse(yqlQuery);
+ assertNull(QueryCanonicalizer.canonicalize(q));
+ assertEquals(q.toString(), expectedQueryTree);
+ }
+
private void assertParseFail(String yqlQuery, Throwable expectedException) {
try {
parse(yqlQuery);