Added failing test for special characters in collection values
Change-Id: I8b738e96dda82a1f7a65f7cd669ef8f175d8d058
diff --git a/src/main/antlr/collection/CollectionQuery.g4 b/src/main/antlr/collection/CollectionQuery.g4
index 869b759..bf57cdd 100644
--- a/src/main/antlr/collection/CollectionQuery.g4
+++ b/src/main/antlr/collection/CollectionQuery.g4
@@ -167,7 +167,7 @@
;
multiword
-: '"' WORD+ '"'
+: '"' ~'"'* '"'
;
relation
@@ -182,4 +182,4 @@
: expr EOF
| exprGroup EOF
| relation EOF
-;
\ No newline at end of file
+;
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessor.java
index 7003425..9d167c0 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessor.java
@@ -554,4 +554,4 @@
// Return the generated tree
return tree;
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessorTest.java
index 2cc16dc..61a2813 100644
--- a/src/test/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessorTest.java
@@ -87,6 +87,15 @@
assertEquals("title", res.at("/collection/key").asText());
assertEquals("IDS Mannheim", res.at("/collection/value").asText());
assertEquals("match:contains", res.at("/collection/match").asText());
+
+ collection = "title~\"IDS:Mannheim\"";
+ qs.setQuery(query, ql);
+ qs.setCollection(collection);
+ res = mapper.readTree(qs.toJSON());
+ assertEquals("koral:doc", res.at("/collection/@type").asText());
+ assertEquals("title", res.at("/collection/key").asText());
+ assertEquals("IDS:Mannheim", res.at("/collection/value").asText());
+ assertEquals("match:contains", res.at("/collection/match").asText());
}
@Test