Fixed serialization of optional expansions

Change-Id: I6d406fb55a3646ac7e1990036a9a1a9cb15cebbe
diff --git a/Readme.md b/Readme.md
index d259816..e22caa6 100644
--- a/Readme.md
+++ b/Readme.md
@@ -46,9 +46,9 @@
 
 ## Prerequisites
 
-At least Java 7,
+Java 7 SDK,
 [Git](http://git-scm.com/),
-[Maven](https://maven.apache.org/).
+[Maven 3](https://maven.apache.org/).
 Further dependencies are resolved using Maven.
 
 
@@ -61,7 +61,7 @@
 $ cd Krill
 ```
 
-To run the test suite (you will need Java SDK and Maven 3) ...
+To run the test suite ...
 
 ```
 $ mvn clean test
diff --git a/src/main/java/de/ids_mannheim/korap/Krill.java b/src/main/java/de/ids_mannheim/korap/Krill.java
index 72373db..8800604 100644
--- a/src/main/java/de/ids_mannheim/korap/Krill.java
+++ b/src/main/java/de/ids_mannheim/korap/Krill.java
@@ -181,6 +181,8 @@
                     // Serialize a Lucene SpanQuery based on the SpanQueryWrapper
                     this.spanQuery = qw.toQuery();
 
+                    // TODO: Make these information query rewrites in toFinalQuery()
+
                     // Throw a warning in case the root object is optional
                     if (qw.isOptional())
                         this.addWarning(781, "Optionality of query is ignored");
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSequenceQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSequenceQueryWrapper.java
index 211c113..2ef20f0 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSequenceQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanSequenceQueryWrapper.java
@@ -938,7 +938,7 @@
                         problem.getClassNumber());
 
             query = new SpanExpansionQuery(anchor.retrieveNode(
-                    this.retrieveNode).toQuery(), problem.getMin(),
+                                                               this.retrieveNode).toQuery(), problem.isOptional() ? 0 : problem.getMin(),
                     problem.getMax(), direction,
                     problem.hasClass() ? problem.getClassNumber() : (byte) 0,
                     true);