Updated error code, commented AND operation
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CQLTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CQLTree.java
index f9c0213..b057eeb 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CQLTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CQLTree.java
@@ -56,7 +56,7 @@
@Override
public void process(String query) throws QueryException {
if ((query == null) || query.isEmpty())
- throw new QueryException(400, "SRU diagnostic 27: An empty query is unsupported.");
+ throw new QueryException(301, "SRU diagnostic 27: An empty query is unsupported.");
CQLNode cqlNode = parseQuerytoCQLNode(query);
Map<String,Object> queryMap = parseCQLNode(cqlNode);
@@ -103,13 +103,13 @@
if (node instanceof CQLTermNode) {
return parseTermNode((CQLTermNode) node);
- } else if (node instanceof CQLAndNode) {
- return parseAndNode((CQLAndNode) node);
+ /*} else if (node instanceof CQLAndNode) {
+ return parseAndNode((CQLAndNode) node);*/
} else if (node instanceof CQLOrNode) {
return parseOrNode((CQLOrNode) node);
} else {
- throw new QueryException(400, "SRU diagnostic 48: Only basic search including term-only " +
- "and boolean operator queries (AND and OR) are currently supported.");
+ throw new QueryException(105, "SRU diagnostic 48: Only basic search including term-only " +
+ "and boolean OR operator queries are currently supported.");
}
}
@@ -117,7 +117,7 @@
checkTermNode(node);
final String term = node.getTerm();
if ((term == null) || term.isEmpty()) {
- throw new QueryException(400, "SRU diagnostic 27: An empty term is unsupported.");
+ throw new QueryException(301, "SRU diagnostic 27: An empty term is unsupported.");
} else if (term.contains(" ")) {
return writeSequence(term);
} else {
@@ -199,7 +199,7 @@
List<Modifier> modifiers = node.getModifiers();
if ((modifiers != null) && !modifiers.isEmpty()) {
Modifier modifier = modifiers.get(0);
- throw new QueryException(400, "SRU diagnostic 20: Relation modifier " +
+ throw new QueryException(105, "SRU diagnostic 20: Relation modifier " +
modifier.toCQL() + " is not supported.");
}
}
@@ -208,7 +208,7 @@
// only allow "cql.serverChoice" and "words" index
if (!(INDEX_CQL_SERVERCHOICE.equals(node.getIndex()) ||
INDEX_WORDS.equals(node.getIndex()))) {
- throw new QueryException(400, "SRU diagnostic 16: Index " + node.getIndex() + " is not supported.");
+ throw new QueryException(105, "SRU diagnostic 16: Index " + node.getIndex() + " is not supported.");
}
// only allow "=" relation without any modifiers
CQLRelation relation = node.getRelation();
@@ -216,13 +216,13 @@
if (!(TERM_RELATION_CQL_1_1.equals(baseRel) ||
TERM_RELATION_CQL_1_2.equals(baseRel) ||
SUPPORTED_RELATION_EXACT.equals(baseRel))) {
- throw new QueryException(400, "SRU diagnostic 19: Relation " +
+ throw new QueryException(105, "SRU diagnostic 19: Relation " +
relation.getBase() + " is not supported.");
}
List<Modifier> modifiers = relation.getModifiers();
if ((modifiers != null) && !modifiers.isEmpty()) {
Modifier modifier = modifiers.get(0);
- throw new QueryException(400, "SRU diagnostic 20: Relation modifier " +
+ throw new QueryException(105, "SRU diagnostic 20: Relation modifier " +
modifier.getValue() + " is not supported.");
}
}
diff --git a/src/test/java/CQLTest.java b/src/test/java/CQLTest.java
index b372ce0..e410281 100644
--- a/src/test/java/CQLTest.java
+++ b/src/test/java/CQLTest.java
@@ -62,7 +62,7 @@
}
}
- @Test
+/* @Test
public void testAndQuery() throws CQLParseException, IOException, QueryException{
query="(Sonne) and (scheint)";
String jsonLd =
@@ -81,9 +81,9 @@
serializedQuery = mapper.writeValueAsString(cqlTree.getRequestMap().get("query"));
assertEquals(jsonLd.replace(" ", ""), serializedQuery.replace("\"", ""));
- }
+ }*/
- @Test
+/* @Test
public void testBooleanQuery() throws CQLParseException, IOException, QueryException{
query="((Sonne) or (Mond)) and (scheint)";
String jsonLd =
@@ -116,7 +116,7 @@
serializedQuery = mapper.writeValueAsString(cqlTree.getRequestMap().get("query"));
assertEquals(jsonLd.replace(" ", ""), serializedQuery.replace("\"", ""));
- }
+ }*/
@Test
public void testOrQuery() throws CQLParseException, IOException, QueryException{