Throw error for optionality in distances

Change-Id: Ib555eef2cf512ce4bf443779096175c3009cc431
diff --git a/Changes b/Changes
index db856cd..2cbdcf7 100644
--- a/Changes
+++ b/Changes
@@ -1,164 +1,170 @@
+0.55.7 2016-10-10
+        - [bugfix] Throw error on optional operands in distance
+          queries (diewald)
+        - [performance] Remember solved problematic queries in the
+          query planner (diewald)
+
 0.55.6 2016-08-10
         - [bugfix] distance with key "t" uses default foundry (diewald)
-	- [cleanup] Renamed fromJson() to fromKoral() (diewald)
-	- [cleanup] Removed deprecated methods in Krill:
-	  setSpanQuery(), getRequest() (diewald)
-	- [cleanup] Removed deprecated method in KrillIndex:
-	  search() (diewald)
+        - [cleanup] Renamed fromJson() to fromKoral() (diewald)
+        - [cleanup] Removed deprecated methods in Krill:
+          setSpanQuery(), getRequest() (diewald)
+        - [cleanup] Removed deprecated method in KrillIndex:
+          search() (diewald)
         - [documentation] Refer to KoralQuery instead of Koral (diewald)
-	- [cleanup] Removed deprecated method in KrillCollection:
-	  getCount() (diewald)
-	- [feature] Added getDoc() method to KrillIndex (diewald)
+        - [cleanup] Removed deprecated method in KrillCollection:
+          getCount() (diewald)
+        - [feature] Added getDoc() method to KrillIndex (diewald)
         - [bugfix] Fixed UID handling (diewald)
-	- [feature] Added document method to Web-API (diewald)
-	- [feature] Added experimental KrillStats class (diewald)
-	- [bugfix] Escape quotes in JSON strings (diewald)
-	- [bugfix] Escape XML and Brackets in snippets correctly (diewald)
-	- [feature] Differ between matching scope and match highlighting,
-	  in case the match was extended to the sentence scope (diewald)
-	- [bugfix] KoralQuery bugs are now correctly moved to responses (diewald)
-	- [security] Do not mirror arbitrary JSON objects (diewald)
-  - [bugfix] Fixed zero-boundary repetition bug (diewald)
+        - [feature] Added document method to Web-API (diewald)
+        - [feature] Added experimental KrillStats class (diewald)
+        - [bugfix] Escape quotes in JSON strings (diewald)
+        - [bugfix] Escape XML and Brackets in snippets correctly (diewald)
+        - [feature] Differ between matching scope and match highlighting,
+          in case the match was extended to the sentence scope (diewald)
+        - [bugfix] KoralQuery bugs are now correctly moved to responses (diewald)
+        - [security] Do not mirror arbitrary JSON objects (diewald)
+        - [bugfix] Fixed zero-boundary repetition bug (diewald)
 
 0.55.5 2016-05-02
-	- [performance] Changed to a dynamic window for sorting in FocusSpans (margaretha)
-	- [bugfix] store skipped spans in Repetitionspans as candidates
-	  (margaretha)
-	- [bugfix] Store lazy loading embedded spans for startsWith in
-	  WithinSpans (diewald)
-	- [bugfix] Fixed loading krill.info in case krill.properties is given
-	  (diewald)
-	- [bugfix] Remove element payloads in SubSpans (similar to Focus)
-	  to prevent wrong highlighting (diewald)
-	- [bugfix] Sort SubSpans (margaretha)
+        - [performance] Changed to a dynamic window for sorting in FocusSpans (margaretha)
+        - [bugfix] store skipped spans in Repetitionspans as candidates
+          (margaretha)
+        - [bugfix] Store lazy loading embedded spans for startsWith in
+          WithinSpans (diewald)
+        - [bugfix] Fixed loading krill.info in case krill.properties is given
+          (diewald)
+        - [bugfix] Remove element payloads in SubSpans (similar to Focus)
+          to prevent wrong highlighting (diewald)
+        - [bugfix] Sort SubSpans (margaretha)
 
 0.55.4 2016-04-22
-	- [bugfix] Wrap <base/s=t> boundaries around right extended queries
-	  (diewald)
-	- [bugfix] Lazy loading bug in WithinSpans (diewald)
-	- [feature] Matching relation nodes with attributes (margaretha)
-	- [bugfix] Removed span id in SegmentSpans, added in NextSpans (margaretha)
-	- [feature] Updated relation deserialization (margaretha)
-	- [feature] Added tests for relation queries and relation deserialization
-	  (margaretha)
-	- [bugfix] Workaround for Nullpointers in SpanOrQuery (diewald)
+        - [bugfix] Wrap <base/s=t> boundaries around right extended queries
+          (diewald)
+        - [bugfix] Lazy loading bug in WithinSpans (diewald)
+        - [feature] Matching relation nodes with attributes (margaretha)
+        - [bugfix] Removed span id in SegmentSpans, added in NextSpans (margaretha)
+        - [feature] Updated relation deserialization (margaretha)
+        - [feature] Added tests for relation queries and relation deserialization
+          (margaretha)
+        - [bugfix] Workaround for Nullpointers in SpanOrQuery (diewald)
 
 0.55.3 2016-02-22
-	- [bugfix] Use base foundry for default sentences and paragraphs
-	  (diewald, margaretha)
-	- [bugfix] Distance constraint exclusion serialized (diewald)
-	- [bugfix] Use indexer without krill.properties packaged (diewald)
-	- [bugfix] Clean pom.xml regarding overlapping dependencies (diewald)
+        - [bugfix] Use base foundry for default sentences and paragraphs
+          (diewald, margaretha)
+        - [bugfix] Distance constraint exclusion serialized (diewald)
+        - [bugfix] Use indexer without krill.properties packaged (diewald)
+        - [bugfix] Clean pom.xml regarding overlapping dependencies (diewald)
 
 0.55.2 2016-02-13
         - [bugfix] Fixed support for corpus and doc IDs containing
-	  dashes (diewald)
-	- [bugfix] Support "s" layer without meaning "surface" -
-	  this is a hack (diewald)
+          dashes (diewald)
+        - [bugfix] Support "s" layer without meaning "surface" -
+          this is a hack (diewald)
 
 0.55.1 2016-02-10
         - [bugfix] Fixed attribute serialization in MatchInfo (diewald)
 
 0.55 2016-02-04
         - [feature] Introducing payload identifiers to the index
-	  structure (diewald, margaretha)
-	  ! This is a major release, introducing index features  !
-	  ! not compatible with indices of old versions of Krill !
+          structure (diewald, margaretha)
+          ! This is a major release, introducing index features  !
+          ! not compatible with indices of old versions of Krill !
 
 0.54 2015-11-13
-   	- [performance] Updated Lucene dependency from 4.10.3
-	  to 5.0.0 (diewald)
+        - [performance] Updated Lucene dependency from 4.10.3
+          to 5.0.0 (diewald)
         - [bugfix] Minor fixes regarding invalid tokens in the
-	  test suite (diewald)
-	- [bugfix] Fixed krill.properties test (diewald)
-	- [bugfix] Fixed multiple distances in disjunction query
-	  (GitHub issue #2; margaretha)
+          test suite (diewald)
+        - [bugfix] Fixed krill.properties test (diewald)
+        - [bugfix] Fixed multiple distances in disjunction query
+          (GitHub issue #2; margaretha)
 
 0.53 2015-09-25
         - [feature] Implemented new KrillCollection (diewald)
-	  This should fix a lot of issues with deleted
-	  documents and negation in virtual collections.
-	- [cleanup] REMOVED deprecated collection filtering (diewald)
-	- [cleanup] REMOVED deprecated termRelation API (diewald)
-	- [feature] Added removal methods for documents (diewald)
-	- [cleanup] REMOVED search method in KrillCollection (diewald)
+          This should fix a lot of issues with deleted
+          documents and negation in virtual collections.
+        - [cleanup] REMOVED deprecated collection filtering (diewald)
+        - [cleanup] REMOVED deprecated termRelation API (diewald)
+        - [feature] Added removal methods for documents (diewald)
+        - [cleanup] REMOVED search method in KrillCollection (diewald)
         - [bugfix] Fixed collection statistics (diewald)
-	- [feature] Improved packaging (diewald)
-	- [feature] Introduced cmd options for server (diewald)
-    	- [feature] Return meta data on server-based indexation (diewald)
+        - [feature] Improved packaging (diewald)
+        - [feature] Introduced cmd options for server (diewald)
+        - [feature] Return meta data on server-based indexation (diewald)
 
 0.52 2015-07-08
         - [bugfix] Fixed payload filtering in FocusSpans (margaretha)
-	- [workaround] Reintroduced empty collection support,
-	  as Koral still creates them (diewald)
-	- [bugfix] Escaped characters now supported in MutiTerm (diewald)
-	- [feature] Deserialization of flags (diewald)
-	- [feature] Made responses valid KoralQueries (diewald)
-	- [bugfix] Fixed sequence deserialization bug for simple unordered
-	  constraint (diewald)
-	- [bugfix] Mirror collection (diewald)
-	- [bugfix] Updated default fields for meta data (diewald)
-	- [bugfix] Updated match identifier for "sigle" data (diewald)
-	- [workaround] Support corpusID/docID and textSigle match strings
-	  (diewald)
-	- [workaround] Support matches starting with "contains"
-	  (Kustvakt bug/diewald)
-	- [bugfix] Fixed treatment of several collection types (diewald)
-	- [bugfix] Remove legacy error handling in Match (diewald)
-	- [bugfix] JSON-serialization bug in match in case of
-	  error messages (diewald)
-	- [bugfix] 'fields' serialization (diewald)
-	- [bugfix] Deserialization of group:disjunction (diewald)
-	- [bugfix] Deserialization of wrapped spans (diewald)
-	- [bugfix] Fix KoralQuery mirroring in case of
-	  parsing failures (diewald)
-	- [feature] Support '@all' as a 'fields' value for all meta
-	  data fields (diewald)
-	- [bugfix] Fix case sensitivity bug in filters (diewald)
-	- [bugfix] Fix sentence expansion bug for new data (diewald)
-	- [bugfix] Deserialization of 'containsnot' instead of 'excludes'
-	  (diewald)
+        - [workaround] Reintroduced empty collection support,
+          as Koral still creates them (diewald)
+        - [bugfix] Escaped characters now supported in MutiTerm (diewald)
+        - [feature] Deserialization of flags (diewald)
+        - [feature] Made responses valid KoralQueries (diewald)
+        - [bugfix] Fixed sequence deserialization bug for simple unordered
+          constraint (diewald)
+        - [bugfix] Mirror collection (diewald)
+        - [bugfix] Updated default fields for meta data (diewald)
+        - [bugfix] Updated match identifier for "sigle" data (diewald)
+        - [workaround] Support corpusID/docID and textSigle match strings
+          (diewald)
+        - [workaround] Support matches starting with "contains"
+          (Kustvakt bug/diewald)
+        - [bugfix] Fixed treatment of several collection types (diewald)
+        - [bugfix] Remove legacy error handling in Match (diewald)
+        - [bugfix] JSON-serialization bug in match in case of
+          error messages (diewald)
+        - [bugfix] 'fields' serialization (diewald)
+        - [bugfix] Deserialization of group:disjunction (diewald)
+        - [bugfix] Deserialization of wrapped spans (diewald)
+        - [bugfix] Fix KoralQuery mirroring in case of
+          parsing failures (diewald)
+        - [feature] Support '@all' as a 'fields' value for all meta
+          data fields (diewald)
+        - [bugfix] Fix case sensitivity bug in filters (diewald)
+        - [bugfix] Fix sentence expansion bug for new data (diewald)
+        - [bugfix] Deserialization of 'containsnot' instead of 'excludes'
+          (diewald)
 
 0.51 2015-03-17
         - This is a major version (prepared for the GitHub release)
         - [cleanup] Changed groupID to "de.ids_mannheim.korap",
-	  renamed korap-style.xml to Format.xml (diewald)
-	- [bugfix] Updated Format.xml to work with
-	  recent versions of Eclipse (diewald)
+          renamed korap-style.xml to Format.xml (diewald)
+        - [bugfix] Updated Format.xml to work with
+          recent versions of Eclipse (diewald)
         - [documentation] Improved documentation for API classes (diewald)
-	- [bugfix] Updated AttributeSpans (margaretha)
-	- [bugfix] Updated SpanRelationQuery (margaretha)
-	- [cleanup] Autoformat (diewald)
+        - [bugfix] Updated AttributeSpans (margaretha)
+        - [bugfix] Updated SpanRelationQuery (margaretha)
+        - [cleanup] Autoformat (diewald)
         - [documentation] References added to the Readme (diewald)
-	- [bugfix] Improved failing for missing property file (kupietz)
-	- [bugfix] Fixed tests for server responses to not use
-	  Jackson deserialization (diewald)
-	- [cleanup] No more jersey logging in tests (diewald)
+        - [bugfix] Improved failing for missing property file (kupietz)
+        - [bugfix] Fixed tests for server responses to not use
+          Jackson deserialization (diewald)
+        - [cleanup] No more jersey logging in tests (diewald)
 
 0.50.1 2015-03-02
-	- [feature] Deserialization of arbitrary elements with
-	  attributes (margaretha)
-	- [cleanup] Extracted KrillMeta from Krill,
-	  renamed KorapQuery to KrillQuery,
-	  extracted QueryBuilder from KrillQuery,
-	  renamed KorapIndexer to index/Indexer,
-	  renamed KorapDocument to model/AbstractDocument,
-	  renamed KorapMatch to response/Match,
-	  renamed KorapIndex to KrillIndex,
-	  renamed KorapCollection to KrillCollection,
-	  moved collector classes from index to response,
-	  renamed KorapDate to KrillDate,
-	  renamed KorapArray to KrillArray,
-	  renamed KorapByte to KrillByte,
-	  renamed KorapString to KrillString,
-	  moved KorapNode to server/Node,
-	  moved KorapResult to response/Result,
-	  renamed KorapResponse to Response,
-	  moved model/* to index,
-	  moved meta/SearchContext to response/SearchContext,
-	  krillified property files,
-	  added Errorcodes,
-	  removed KrillIndex#addDocFile (diewald)
+        - [feature] Deserialization of arbitrary elements with
+          attributes (margaretha)
+        - [cleanup] Extracted KrillMeta from Krill,
+          renamed KorapQuery to KrillQuery,
+          extracted QueryBuilder from KrillQuery,
+          renamed KorapIndexer to index/Indexer,
+          renamed KorapDocument to model/AbstractDocument,
+          renamed KorapMatch to response/Match,
+          renamed KorapIndex to KrillIndex,
+          renamed KorapCollection to KrillCollection,
+          moved collector classes from index to response,
+          renamed KorapDate to KrillDate,
+          renamed KorapArray to KrillArray,
+          renamed KorapByte to KrillByte,
+          renamed KorapString to KrillString,
+          moved KorapNode to server/Node,
+          moved KorapResult to response/Result,
+          renamed KorapResponse to Response,
+          moved model/* to index,
+          moved meta/SearchContext to response/SearchContext,
+          krillified property files,
+          added Errorcodes,
+          removed KrillIndex#addDocFile (diewald)
         - [documentation] Improved documentation for API classes (diewald)
 
 0.50 2015-02-23
@@ -166,150 +172,150 @@
 
 0.49.4 2015-02-20
         - [documentation] Improved documentation for API classes (diewald)
-	- [cleanup] Improved test coverage for utility classes (diewald)
-   	- [performance] Updated Lucene dependency from 4.5.1 to 4.10.3,
-	  Updated Jackson dependency from 2.4.0 to 2.4.4,
-   	  Updated Jersey dependency from 2.4.1 to 2.15 (diewald)
+        - [cleanup] Improved test coverage for utility classes (diewald)
+        - [performance] Updated Lucene dependency from 4.5.1 to 4.10.3,
+          Updated Jackson dependency from 2.4.0 to 2.4.4,
+          Updated Jersey dependency from 2.4.1 to 2.15 (diewald)
         - [feature] Presorting of element terms in the index for coherent
-	  SpanQuery sorting; Removed buffering of element candidates (diewald)
-	  Warning: This is a breaking change!
-	- [feature] Added CorpusDataException to deal with data importing bugs;
+          SpanQuery sorting; Removed buffering of element candidates (diewald)
+          Warning: This is a breaking change!
+        - [feature] Added CorpusDataException to deal with data importing bugs;
           made some imports break more easily though (diewald)
-	- [performance] Payloads in ElementSpans can now be lazily loaded,
-	  MatchModifyClassSpans no longer rely on payload copies (diewald)
-	- [cleanup] Renamed /filter to /collection, 
-	  merge KorapHTML and KorapString,
-	  removed KorapSpan, KorapTermSpan and KorapLongSpan,
-	  renamed /analysis to /model,
-	  renamed shrink() to focus(),
-	  removed KorapPrimaryData,
+        - [performance] Payloads in ElementSpans can now be lazily loaded,
+          MatchModifyClassSpans no longer rely on payload copies (diewald)
+        - [cleanup] Renamed /filter to /collection, 
+          merge KorapHTML and KorapString,
+          removed KorapSpan, KorapTermSpan and KorapLongSpan,
+          renamed /analysis to /model,
+          renamed shrink() to focus(),
+          removed KorapPrimaryData,
           fixed a lot of wrong tests for WithinSpans,
-	  renamed KorapFilter to /collection/CollectionBuilder,
-	  renamed SpanMatchModify to SpanFocus,
-	  changed KoralQuery root prefix to "koral",
-	  renamed different kinds of "queries" throughout classes,
-	  renamed KorapSearch#run to KorapSearch#apply (diewald)
+          renamed KorapFilter to /collection/CollectionBuilder,
+          renamed SpanMatchModify to SpanFocus,
+          changed KoralQuery root prefix to "koral",
+          renamed different kinds of "queries" throughout classes,
+          renamed KorapSearch#run to KorapSearch#apply (diewald)
         - [feature] Improved deserialization of SpanSubSpanQueries
           (margaretha)
-	- [feature] Introducing the potential need for resorting queries
-	  on focussing (e.g., set by relations) (diewald)
-	- [bugfix] Hopefully fixing a resource related bug for
-	  server instantiation (diewald)
-	- [bugfix] Changed attribute spans to contain element's
-	  width (margaretha)
-	- [feature] Improved highlighting to use semantic html5 (#193; diewald)
+        - [feature] Introducing the potential need for resorting queries
+          on focussing (e.g., set by relations) (diewald)
+        - [bugfix] Hopefully fixing a resource related bug for
+          server instantiation (diewald)
+        - [bugfix] Changed attribute spans to contain element's
+          width (margaretha)
+        - [feature] Improved highlighting to use semantic html5 (#193; diewald)
 
 0.49.3 2015-02-03
         - [documentation] Improved documentation for
-	  API classes (diewald)
-	- [documentation] Improved documentation for
-	  various queries (margaretha)
-	- [feature] Added deserialization of SpanSubSpanQueries
+          API classes (diewald)
+        - [documentation] Improved documentation for
+          various queries (margaretha)
+        - [feature] Added deserialization of SpanSubSpanQueries
           (margaretha, diewald)
-	- [bugfix] Null filters are now correctly extended (diewald)
-	- [cleanup] Refactoring of KorapResult, KorapResponse, KorapQuery,
-	  deprecated operation:or in favor of operation:junction,
-	  updating test suite for class and frame attributes (diewald)
-	- [bugfix] Empty class segments are now correctly serialized
-	  in sequences (diewald)
-	- [feature] Started support for position frames (diewald)
-	- [bugfix] Fixed #134 Nullpointer exception in WithinSpans
-	  (diewald, margaretha)
+        - [bugfix] Null filters are now correctly extended (diewald)
+        - [cleanup] Refactoring of KorapResult, KorapResponse, KorapQuery,
+          deprecated operation:or in favor of operation:junction,
+          updating test suite for class and frame attributes (diewald)
+        - [bugfix] Empty class segments are now correctly serialized
+          in sequences (diewald)
+        - [feature] Started support for position frames (diewald)
+        - [bugfix] Fixed #134 Nullpointer exception in WithinSpans
+          (diewald, margaretha)
 
 0.49.2 2014-12-05
-	- [documentation] Improved documentation for
+        - [documentation] Improved documentation for
           various queries (margaretha)
-	- [feature] Added @Experimental support (margaretha)
-	- [feature] Added Eclipse based code formatting (diewald)
+        - [feature] Added @Experimental support (margaretha)
+        - [feature] Added Eclipse based code formatting (diewald)
 
 0.49.1 2014-11-25
         - [cleanup] Major refactoring for new response messages,
-	  removed deprecated error messaging,
+          removed deprecated error messaging,
           removed long-term deprecated methods in KorapResult,
-	  removed long-term deprecated methods in KorapMatch,
-	  renamed toJSON->toJsonString
-	  renamed toJSONnode->toJsonNode,
-	  renamed fromJSON->fromJson (diewald)
-	- [documentation] Improved documentation for notifications (diewald)
+          removed long-term deprecated methods in KorapMatch,
+          renamed toJSON->toJsonString
+          renamed toJSONnode->toJsonNode,
+          renamed fromJSON->fromJson (diewald)
+        - [documentation] Improved documentation for notifications (diewald)
 
 0.49 2014-11-14
         - This is a major version (prepared for the Evaluation Meeting)
         - [bugfix] Rewrite works in repeating expansions (margaretha)
-	- [feature] Clean timeout with parameter support (diewald)
-	- [workaround] Support unknown overlap frame,
-	  if frames are known (diewald)
-	- [bugfix] Class payload fixed in SpanRepetitions (margaretha)
-	- [bugfix] #179 Expansion bug fixed (margaretha)
-	- [bugfix] Corrected small bug where null warnings where
-	  returned in JSON (diewald)
-	- [cleanup] Converted error to failure (diewald)
-	- [bugfix] Added const layer rewrite (diewald)
+        - [feature] Clean timeout with parameter support (diewald)
+        - [workaround] Support unknown overlap frame,
+          if frames are known (diewald)
+        - [bugfix] Class payload fixed in SpanRepetitions (margaretha)
+        - [bugfix] #179 Expansion bug fixed (margaretha)
+        - [bugfix] Corrected small bug where null warnings where
+          returned in JSON (diewald)
+        - [cleanup] Converted error to failure (diewald)
+        - [bugfix] Added const layer rewrite (diewald)
 
 0.48 2014-11-07
         - This is a major version (prepared for the "Tag der Offenen Tür")
         - [feature] Retrieval of token lists (diewald)
-	- [bugfix] Classes can now be highlighted to 127.
-	- [bugfix] Sequences with distances won't be flattened in
-  	  SpanSequenceQueryWrapper (diewald)
-	- [bugfix] Sequences with [problem][problem][anchor] can now
-	  be deserialized (diewald)
-	- [bugfix] Queries with regular expressions in spanNext() are now
-	  correctly rewritten (diewald)
-	- [bugfix] Ignore foundry for orth layer (diewald)
-	- [feature] Support fields in meta (diewald)
-	- [workaround] Support more legacy APIs (diewald)
-	- [bugfix] Check for the existence of @type in JSON-LD groups
-	  to avoid NullPointer (diewald)
-	- [cleanup] Validated query and collection input - limited
-	  to a "don't break anyting" policy (diewald)
+        - [bugfix] Classes can now be highlighted to 127.
+        - [bugfix] Sequences with distances won't be flattened in
+          SpanSequenceQueryWrapper (diewald)
+        - [bugfix] Sequences with [problem][problem][anchor] can now
+          be deserialized (diewald)
+        - [bugfix] Queries with regular expressions in spanNext() are now
+          correctly rewritten (diewald)
+        - [bugfix] Ignore foundry for orth layer (diewald)
+        - [feature] Support fields in meta (diewald)
+        - [workaround] Support more legacy APIs (diewald)
+        - [bugfix] Check for the existence of @type in JSON-LD groups
+          to avoid NullPointer (diewald)
+        - [cleanup] Validated query and collection input - limited
+          to a "don't break anyting" policy (diewald)
 
 0.47 2014-11-05
         - [feature] Support new index format with more metadata (diewald)
-	- [bugfix] #142 Fixed class spans for skipTo() skips (margaretha)
-	- [feature] Added attribute support to relations (margaretha)
-	- [bugfix] Make classes and shrink default to 1 instead of 0 (diewald)
-	- [bugfix] shrink now removes all non-classes payloads (diewald)
+        - [bugfix] #142 Fixed class spans for skipTo() skips (margaretha)
+        - [feature] Added attribute support to relations (margaretha)
+        - [bugfix] Make classes and shrink default to 1 instead of 0 (diewald)
+        - [bugfix] shrink now removes all non-classes payloads (diewald)
 
 0.46 2014-10-21
         - [feature] Support for relation queries (margaretha)
-	- [feature] Wrapping of extension queries
-	  (not completely tested yet; diewald)
+        - [feature] Wrapping of extension queries
+          (not completely tested yet; diewald)
 
 0.45 2014-10-06
         - [bugfix] Correctly respond request in JSON results (diewald)
         - [cleanup] Made SpanQueryWrapper an abstract class instead
-	  of an interface (diewald)
+          of an interface (diewald)
 
 0.44.1 2014-09-29
         - [cleanup] Prepare test suite for publication (diewald)
 
 0.44 2014-09-28
         - [feature] Match collector using database for
-	  distributed search (diewald)
-	- [bugfix] Unified boundary handling and prevent nullpointer
-	  exceptions on parsing (diewald)
-	- [bugfix] Ordering of payloads reversed to make nesting highlights
-	  nest correctly (diewald)
-   	- [performance] Updated Lucene dependency from 4.3.1 to 4.5.1 (diewald)
-   	- [performance] Updated Jackson dependency from 2.2.2 to 2.4.0 (diewald)
-	- [bugfix] Return matches correctly with JSON (diewald)
-	- [bugfix] Repare database tests working with temporary
-	  databases (diewald)
+          distributed search (diewald)
+        - [bugfix] Unified boundary handling and prevent nullpointer
+          exceptions on parsing (diewald)
+        - [bugfix] Ordering of payloads reversed to make nesting highlights
+          nest correctly (diewald)
+        - [performance] Updated Lucene dependency from 4.3.1 to 4.5.1 (diewald)
+        - [performance] Updated Jackson dependency from 2.2.2 to 2.4.0 (diewald)
+        - [bugfix] Return matches correctly with JSON (diewald)
+        - [bugfix] Repare database tests working with temporary
+          databases (diewald)
 
 0.43 2014-09-23
         - [cleanup] Made a lot of stuff rely on KorapResponse (diewald)
-	- [bugfix] Small but ancient collection bug fixed (diewald)
-	- [feature] Collect first matches of documents based on UIDs (diewald)
+        - [bugfix] Small but ancient collection bug fixed (diewald)
+        - [feature] Collect first matches of documents based on UIDs (diewald)
 
 0.42 2014-09-19
         - [cleanup] Extracted private classes from KorapMatch (diewald)
-	- [bugfix] Fix query rewrite in contains-queries (diewald)
+        - [bugfix] Fix query rewrite in contains-queries (diewald)
 
 0.41 2014-09-17
         - [feature] getStartPos(classNr) and getEndPos(classNr)
           in KorapMatch (diewald)
         - [bugfix] SpanExpansionQuery with fixed Constructor
-	  and Exclusion handling (margaretha)
+          and Exclusion handling (margaretha)
         - [feature] Early implementation of match collector (diewald)
 
 0.40 2014-09-03
@@ -321,10 +327,10 @@
 
 0.32 2014-08-01
         - [bugfix] Fix for repetition candidates (margaretha)
- 	- [bugfix] Some fixes for negative segments (diewald)
- 	- [bugfix] SpanMatchModify now skips in case the
-	  requested class isn't found (diewald)
- 	- [performance] Some logging issues fixed (diewald)
+        - [bugfix] Some fixes for negative segments (diewald)
+        - [bugfix] SpanMatchModify now skips in case the
+          requested class isn't found (diewald)
+        - [performance] Some logging issues fixed (diewald)
 
 0.31.8 2014-07-24
         - [feature] Added optionality to querys for quantifiers (diewald)
@@ -335,31 +341,31 @@
 
 0.31.6 2014-06-30
         - [feature] Support for korap:reference deserialization (diewald)
-	- [feature] Preliminary support for attributes in elements (margaretha)
-	- [feature] Preliminary support operation:repetition deserialization
-	  (unfinished and untested; diewald)
+        - [feature] Preliminary support for attributes in elements (margaretha)
+        - [feature] Preliminary support operation:repetition deserialization
+          (unfinished and untested; diewald)
 
 0.31.5 2014-06-17
         - [feature] Batch return of defined foundries and layers in
-	  getMatchInfo() (diewald)
-	- [security] Improve foundry and layer check before injection in
-	  regex (diewald)
+          getMatchInfo() (diewald)
+        - [security] Improve foundry and layer check before injection in
+          regex (diewald)
 
 0.31.4 2014-06-16
         - [feature] MatchModifyClassQuery now can extend (diewald)
-	- [bugfix] Make matchinfo a bit more robust (diewald)
+        - [bugfix] Make matchinfo a bit more robust (diewald)
 
 0.31.3 2014-06-11
         - [bugfix] Minor bugfix regarding treatment of
-	  failed search results (diewald)
+          failed search results (diewald)
 
 0.31.2 2014-05-28
         - [feature] Request parameter "itemsPerResource" limits
-	  hits per document (diewald)
+          hits per document (diewald)
 
 0.31.1 2014-05-21
         - [bugfix] Minor bugfix for wrongly serialized contexts
-	  in responses (diewald)
+          in responses (diewald)
 
 0.31.0 2014-05-20
         - [feature] span contexts in JSON-LD are now supported
@@ -369,39 +375,39 @@
 
 0.30.9 2014-04-11
         - [bugfix] Prevent multiple identifiers in
-	  relation highlighting (diewald)
+          relation highlighting (diewald)
 
 0.30.8 2014-04-10
         - Added getTermRelationJSON() to KorapCollection (diewald)
-	  This is likely to get deprecated!
+          This is likely to get deprecated!
 
 0.30.7 2014-04-09
         - Moved JSON interpretation from BooleanFilter to KorapFilter (diewald)
-	- Added 'or' and group nesting to KorapFilter (diewald)
+        - Added 'or' and group nesting to KorapFilter (diewald)
 
 0.30.6 2014-03-20
         - Refactoring and cleaning of ElementSpans (diewald)
-	- [bugfix] Stabilizing KorapMatch (diewald)
+        - [bugfix] Stabilizing KorapMatch (diewald)
 
 0.30.5 2014-03-18
-	- Support for Quantifier Queries (margaretha)
-	- Some benchmarks (margaretha)
+        - Support for Quantifier Queries (margaretha)
+        - Some benchmarks (margaretha)
         - [bugfix] WithinSpans respect match payloads,
-	  and are now way more correct ;) (diewald)
-	- Support for overlap queries (diewald)
-	- Refactoring of WithinSpans (diewald)
-	- Introducing lazy loading for wrapper .end() in WithinSpans (diewald)
+          and are now way more correct ;) (diewald)
+        - Support for overlap queries (diewald)
+        - Refactoring of WithinSpans (diewald)
+        - Introducing lazy loading for wrapper .end() in WithinSpans (diewald)
 
 0.30.4 2014-02-26
         - [cleanup] Making MultiTerm* more robust (diewald)
 
 0.30.3 2014-02-20
         - Return json request in response if given (diewald)
-	- [bugfix] ClassSpans and WithinSpans check skipTo
-	  in advance now (diewald)
-	- Compilerfriendly logging rules, resulting
-	  in significant performance improvements (diewald)
-	- Small refactorings (diewald)
+        - [bugfix] ClassSpans and WithinSpans check skipTo
+          in advance now (diewald)
+        - Compilerfriendly logging rules, resulting
+          in significant performance improvements (diewald)
+        - Small refactorings (diewald)
 
 0.30.2 2014-02-14
         - [bugfix] wrapper uses correct distance constraint (diewald)
@@ -411,112 +417,112 @@
 
 0.30 2014-02-13
         - This is a major version
-	  (prepared for the IDS meeting on the 17th of february)
-	- Improved stringification for distance queries (margaretha)
+          (prepared for the IDS meeting on the 17th of february)
+        - Improved stringification for distance queries (margaretha)
 
 0.26.4 2014-02-12
         - Serialize SpanDistanceQueries and SpanMultipleDistanceQueries
           (diewald)
-	- [temporarily] Added default foundry "mate" in KorapQuery (diewald)
+        - [temporarily] Added default foundry "mate" in KorapQuery (diewald)
 
 0.26.3 2014-02-12
         - [bugfix] Only open writer in case it's needed (diewald)
 
 0.26.2 2014-02-12
         - Added sequence queries with defined gaps (margaretha)
-	- Support for multiple distance constraints (margaretha)
-	- Updated json-ld deserialization with nested meta (diewald)
-	- [bugfix] Wildcards in segments were ignored (diewald)
+        - Support for multiple distance constraints (margaretha)
+        - Updated json-ld deserialization with nested meta (diewald)
+        - [bugfix] Wildcards in segments were ignored (diewald)
 
 0.26.1 2014-01-21
         - Distinct Match retrieval including spans
-	  and dependency relations (diewald)
+          and dependency relations (diewald)
 
 0.26 2014-01-16
         - Introduced standalone SpanSegmentQueries (margaretha)
         - [bugfix] SpanNextQueries (margaretha)
-	- Support for Match Identifiers (diewald)
-	- Support for distinct Match retrieval (diewald)
+        - Support for Match Identifiers (diewald)
+        - Support for distinct Match retrieval (diewald)
 
 0.25.3 2014-01-10
         - Updated Lucene to 4.3.1 (diewald)
-	- Welcome! Eliza Margaretha has joined the team!
+        - Welcome! Eliza Margaretha has joined the team!
 
 0.25.2 2013-12-29
         - Fixed highlight bug with empty reopened tags
 
 0.25.1 2013-12-28
         - Support for pubDate collections
-	- Changed versioning scheme
+        - Changed versioning scheme
 
 0.25 2013-12-20
         - Support for Wildcard Queries
-	- Improved support for regular expressions
-	- Introduced keyword fields that store no positions
+        - Improved support for regular expressions
+        - Introduced keyword fields that store no positions
 
 0.24_1 2013-12-05
         - This is a pseudo version for demo versions with dirty hacks,
-	  meant to be rolled back!
-	- There is now an ignored broken test in TestKorapCollection
+          meant to be rolled back!
+        - There is now an ignored broken test in TestKorapCollection
 
 0.24 2013-12-05
         - Json deserializer finished for virtual collections
 
 0.23 2013-12-05
         - Error handling corrected in KorapResult
-	- Json deserializer finished for queries
+        - Json deserializer finished for queries
 
 0.22 2013-12-04
         - Introduced KorapSearch
-	- Json deserializer (started)
+        - Json deserializer (started)
 
 0.21 2013-11-28
         - Virtual collections can now be defined,
-	  searched, nested and extended
+          searched, nested and extended
 
 0.20 2013-11-18
         - Unboxing from sandbox repository
 
 0.11 2013-11-14
-	- JSON file importer (plain and gzip)
-	- [bugfix] Element Query
-	- [bugfix] Sequence Query
+        - JSON file importer (plain and gzip)
+        - [bugfix] Element Query
+        - [bugfix] Sequence Query
 
 0.10 2013-11-11
         - Added JSON input to indexer
 
 0.09 2013-11-07
         - Reconstruction of all wrapper queries using an interface
-	- Finished KorapQuery (preliminary feature freeze)
+        - Finished KorapQuery (preliminary feature freeze)
 
 0.08 2013-10-18
         - Changed methods to attributes in KorapMatch
-	- Changed SimpleJSON to Jackson
-	- Fixed Highlighting
-	- Some Refactoring of result classes
-	- Introduced KorapDocument
-	- Introduced KorapHTML utility
+        - Changed SimpleJSON to Jackson
+        - Fixed Highlighting
+        - Some Refactoring of result classes
+        - Introduced KorapDocument
+        - Introduced KorapHTML utility
 
 0.07 2013-10-14
         - Added position to offset matching
 
 0.06 2013-10-01
         - Added SpanElementQuery for working WithinQeries
-	- Added KorapResult and KorapMatching
+        - Added KorapResult and KorapMatching
 
 0.05 2013-09-18
         - Fixed bug in indexing (MultiTermTokenStream)
-	- Fixed SpanNext
-	- Added KorapIndex
-	- First draft for KorapFilter
+        - Fixed SpanNext
+        - Added KorapIndex
+        - First draft for KorapFilter
 
 0.04 2013-09-01
         - Introduced optimized SpanNext class (not working atm),
-	  as SpanNear does not always work with nested synonyms
+          as SpanNear does not always work with nested synonyms
 
 0.03 2013-08-28
         - Added within query (not working atm)
-	- Pushed query part to public repo
+        - Pushed query part to public repo
 
 0.02 2013-08-26
         - Added sequences
diff --git a/pom.xml b/pom.xml
index 4b2b844..31efb78 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
 
   <groupId>de.ids_mannheim.korap</groupId>
   <artifactId>Krill</artifactId>
-  <version>0.55.6</version>
+  <version>0.55.7</version>
   <packaging>jar</packaging>
 
   <name>Krill</name>
diff --git a/src/main/java/de/ids_mannheim/korap/Krill.java b/src/main/java/de/ids_mannheim/korap/Krill.java
index de55528..437e1e9 100644
--- a/src/main/java/de/ids_mannheim/korap/Krill.java
+++ b/src/main/java/de/ids_mannheim/korap/Krill.java
@@ -178,10 +178,10 @@
                 // Throw an error, in case the query matches everywhere
                 if (qw.isEmpty()) {
                     this.addError(780, "This query matches everywhere");
-				}
-				else if (qw.isNull()) {
-					this.addError(783, "This query can't match anywhere");
-				}
+                }
+                else if (qw.isNull()) {
+                    this.addError(783, "This query can't match anywhere");
+                }
 
                 else {
 
diff --git a/src/main/java/de/ids_mannheim/korap/KrillQuery.java b/src/main/java/de/ids_mannheim/korap/KrillQuery.java
index 3185603..3d70505 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillQuery.java
@@ -115,7 +115,7 @@
             // Set max boundary
             this.max = json.has("max") ? json.get("max").asInt(defaultMax)
                     : defaultMax;
-			
+
             if (DEBUG)
                 log.trace("Found koral:boundary with {}:{}", min, max);
         };
@@ -723,12 +723,12 @@
         // Check relation between min and max
         if (min > max)
             max = max;
-		
+
         SpanQueryWrapper sqw = this._fromKoral(operands.get(0));
 
         if (sqw.maybeExtension())
             return sqw.setMin(min).setMax(max);
-		
+
         return new SpanRepetitionQueryWrapper(sqw, min, max);
     };
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanQueryWrapper.java b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanQueryWrapper.java
index 82349b2..f31006d 100644
--- a/src/main/java/de/ids_mannheim/korap/query/wrap/SpanQueryWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/query/wrap/SpanQueryWrapper.java
@@ -36,7 +36,7 @@
     protected boolean hasClass = false, isNull = true, isOptional = false,
             isNegative = false, isEmpty = false, isExtended = false,
             isExtendedToTheRight = false, maybeUnsorted = false,
-            retrieveNode = false;
+            retrieveNode = false, isProblematic = false;
 
 
     /**
@@ -47,7 +47,6 @@
      * @throws QueryException
      */
     public SpanQuery toFragmentQuery () throws QueryException {
-        System.err.println("||||||||||||||||||||||||||");
         return (SpanQuery) null;
     };
 
@@ -62,8 +61,9 @@
      */
     public SpanQuery toQuery () throws QueryException {
 
-        if (this.isNull() || this.isEmpty())
+        if (this.isNull() || this.isEmpty()) {
             return null;
+        };
 
         // Wrap the query in a <base/s=t>, if it's extended to the right
         if (this.isExtendedToTheRight()) {
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 72fadb2..f100853 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
@@ -612,6 +612,7 @@
 
 
     public boolean isEmpty () {
+
         if (this.segments.size() == 1)
             return this.segments.get(0).isEmpty();
 
@@ -741,6 +742,11 @@
             return (SpanQuery) query;
         };
 
+        if (this.hasConstraints() && this.isProblematic) {
+            throw new QueryException(613,
+                    "Distance constraints not supported with empty, optional or negative operands");
+        };
+
         // DistanceQueries
         if (this.constraints.size() == 1) {
             DistanceConstraint constraint = this.constraints.get(0);
@@ -753,6 +759,11 @@
                     if (this.segments.get(i).isExtended())
                         throw new QueryException(613, limitationError);
 
+                    /* Maybe important
+                    if (this.segments.get(i).isOptional())
+                        throw new QueryException(613, limitationError);
+                    */
+
                     SpanQuery sq = (SpanQuery) this.segments.get(i)
                             .retrieveNode(this.retrieveNode).toFragmentQuery();
                     if (sq == null)
@@ -772,6 +783,11 @@
                     if (this.segments.get(i).isExtended())
                         throw new QueryException(613, limitationError);
 
+                    /* May be necessary
+                    if (this.segments.get(i).isOptional())
+                        throw new QueryException(613, limitationError);
+                    */
+
                     SpanQuery sq = (SpanQuery) this.segments.get(i)
                             .retrieveNode(this.retrieveNode).toFragmentQuery();
                     if (sq == null)
@@ -817,6 +833,8 @@
       - look for an anchor next to it
       - merge the problematic segment with the anchor
       - go on
+
+      - This does not work for distance constraints!
     */
     private boolean _solveProblematicSequence () {
         int size = this.segments.size();
@@ -838,6 +856,18 @@
                 if (DEBUG)
                     log.trace("segment {} is problematic", i);
 
+                // Sequences with distance constraints do not support empty or optional
+                // elemets
+                if (this.hasConstraints()) {
+                    if (DEBUG) {
+                        log.trace("Sequence has constraints, "
+                                + "that do not allow empty or optional elements");
+                    };
+                    this.isSolved = true;
+                    this.isProblematic = true;
+                    return false;
+                };
+
                 // [problem][anchor]
                 if (i < (size - 1) && this.segments.get(i + 1).maybeAnchor()) {
                     if (DEBUG)
@@ -853,6 +883,8 @@
 
                     // An error occurred while solving the problem
                     catch (QueryException e) {
+                        this.isSolved = true;
+                        this.isProblematic = true;
                         return false;
                     };
 
@@ -880,6 +912,8 @@
                                         true));
                     }
                     catch (QueryException e) {
+                        this.isSolved = true;
+                        this.isProblematic = true;
                         return false;
                     };
 
@@ -916,10 +950,12 @@
                 return _solveProblematicSequence();
 
             this.isSolved = true;
-            return true;
+            this.isProblematic = true;
+            return false; // true;
         };
 
         this.isSolved = true;
+        this.isProblematic = false;
         return false;
     };
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
index 8a0ac45..072a633 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMatchIdentifier.java
@@ -277,10 +277,10 @@
 
         /*
         km = ki.getMatchInfo(
-			"match-GOE!GOE_AGX.00002-p10-20",
-							 "tokens", true, (String) null, (String) null, true, true, false);	
+        	"match-GOE!GOE_AGX.00002-p10-20",
+        					 "tokens", true, (String) null, (String) null, true, true, false);	
         assertEquals("", km.toJsonString());
-		*/		
+        */
     };
 
 
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestRepetitionIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestRepetitionIndex.java
index cedb868..131ae70 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestRepetitionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRepetitionIndex.java
@@ -204,6 +204,7 @@
         //		}
     }
 
+
     @Test
     public void testCase5 () throws IOException {
         ki = new KrillIndex();
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
index 31a3612..f11a5da 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
@@ -571,15 +571,17 @@
         };
     };
 
-	@Test
+
+    @Test
     public void queryJSONdistancesWithRegexes () throws QueryException {
-		// "der" []{2,3} [opennlp/p="NN"]
+        // "der" []{2,3} [opennlp/p="NN"]
         try {
             String json = getString(getClass().getResource(
                     "/queries/bugs/distances_with_regex_bug.jsonld").getFile());
             KrillQuery kq = new KrillQuery("tokens");
 
-            assertEquals(kq.fromKoral(json).toQuery().toString(),
+            assertEquals(
+                    kq.fromKoral(json).toQuery().toString(),
                     "spanDistance(SpanMultiTermQueryWrapper(tokens:/s:der/), SpanMultiTermQueryWrapper(tokens:/opennlp/p:NN/), [(w[3:4], ordered, notExcluded)])");
         }
         catch (QueryException e) {
@@ -587,6 +589,7 @@
         };
     };
 
+
     public static String getString (String path) {
         StringBuilder contentBuilder = new StringBuilder();
         try {
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
index e5030f8..97a9eb2 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestSpanSequenceQueryJSON.java
@@ -283,7 +283,7 @@
         }
         catch (QueryException qe) {
             assertEquals(
-                    "Distance constraints not supported with empty or negative operands",
+                    "Distance constraints not supported with empty, optional or negative operands",
                     qe.getMessage());
         };
     };
@@ -351,27 +351,34 @@
                 sqwi.toQuery().toString());
     };
 
+
     @Test
-    public void queryJSONkoralOptionalityInDistanceBug () throws QueryException {
-		// Sonne [] Mond?
-        SpanQueryWrapper sqwi = jsonQueryFile("distance-with-optionality.jsonld");
-        assertEquals(
-			"focus(254: spanContain(<tokens:base/s:t />, {254: spanOr([spanExpansion(tokens:s:Sonne, []{1, 1}, right), spanNext(spanExpansion(tokens:s:Sonne, []{1, 1}, right), tokens:s:Mond)])}))",
-			sqwi.toQuery().toString());
-		// Could also be a distance at the end ... that's a query planner thing.
+    public void queryJSONkoralOptionalityInDistanceBug () {
+        try {
+            // Sonne [] Mond?
+            SpanQueryWrapper sqwi = jsonQueryFile("distance-with-optionality.jsonld");
+            sqwi.toQuery().toString();
+        }
+        catch (QueryException qe) {
+            assertEquals(
+                    "Distance constraints not supported with empty, optional or negative operands",
+                    qe.getMessage());
+        }
+        // Could also be a distance at the end ... that's a query planner thing.
     };
 
-	@Test
+
+    @Test
     public void queryJSONkoralOptionalityAfterEmptyBug () throws QueryException {
-		// Sonne [] Mond?
+        // Sonne [] Mond?
         SpanQueryWrapper sqwi = jsonQueryFile("empty-followed-by-optionality.jsonld");
         assertEquals(
-			"focus(254: spanContain(<tokens:base/s:t />, {254: spanOr([spanExpansion(tokens:s:Sonne, []{1, 1}, right), spanNext(spanExpansion(tokens:s:Sonne, []{1, 1}, right), tokens:s:Mond)])}))",
-			sqwi.toQuery().toString());
-		// Could also be a distance at the end ... that's a query planner thing.
+                "focus(254: spanContain(<tokens:base/s:t />, {254: spanOr([spanExpansion(tokens:s:Sonne, []{1, 1}, right), spanNext(spanExpansion(tokens:s:Sonne, []{1, 1}, right), tokens:s:Mond)])}))",
+                sqwi.toQuery().toString());
+        // Could also be a distance at the end ... that's a query planner thing.
     };
 
-	
+
 
     // get query wrapper based on json file
     public SpanQueryWrapper jsonQueryFile (String filename) {
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
index 1fb1f2b..7ecf1c2 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
@@ -1019,28 +1019,29 @@
                 "Operation needs operand list");
     };
 
-	
-	@Test
+
+    @Test
     public void searchJSONdistanceWithRegexesBug () throws IOException {
         // Construct index
         KrillIndex ki = new KrillIndex();
         // Indexing test files
         for (String i : new String[] { "00001" }) {
-			// , "00002", "00003", "00004", "00005", "00006", "02439"
+            // , "00002", "00003", "00004", "00005", "00006", "02439"
             ki.addDoc(
                     getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
                     true);
         };
         ki.commit();
 
-		// "der" []{2,3} [opennlp/p="NN"]
-       String json = getString(getClass().getResource(
+        // "der" []{2,3} [opennlp/p="NN"]
+        String json = getString(getClass().getResource(
                 "/queries/bugs/distances_with_regex_bug.jsonld").getFile());
 
         Result kr = new Krill(json).apply(ki);
 
-		assertEquals(kr.getMatch(0).getSnippetBrackets(),
-					 "Mit Ausnahme von Fremdwörtern und Namen ist das A der einzige Buchstabe im Deutschen, [[der zweifach am Anfang]] eines Wortes stehen darf, etwa im Wort Aal.");
+        assertEquals(
+                kr.getMatch(0).getSnippetBrackets(),
+                "Mit Ausnahme von Fremdwörtern und Namen ist das A der einzige Buchstabe im Deutschen, [[der zweifach am Anfang]] eines Wortes stehen darf, etwa im Wort Aal.");
 
     };
 
@@ -1128,22 +1129,24 @@
         assertEquals(kr.getTotalResults(), 1);
     };
 
-	
-	@Test
+
+    @Test
     public void queryJSONzeroRepetitionBug () throws IOException {
-		// der{0}
-		KrillIndex ki = new KrillIndex();
-		ki.addDoc(getClass().getResourceAsStream("/wiki/00001.json.gz"), true);
-		ki.commit();
-			
-		String json = getString(getClass().getResource(
-									"/queries/bugs/zero_repetition_bug.jsonld").getFile());
+        // der{0}
+        KrillIndex ki = new KrillIndex();
+        ki.addDoc(getClass().getResourceAsStream("/wiki/00001.json.gz"), true);
+        ki.commit();
 
-		Result kr = new Krill(json).apply(ki);
+        String json = getString(getClass().getResource(
+                "/queries/bugs/zero_repetition_bug.jsonld").getFile());
 
-		assertEquals(783, kr.getError(0).getCode());
-		assertEquals("This query can't match anywhere", kr.getError(0).getMessage());
-	};
+        Result kr = new Krill(json).apply(ki);
+
+        assertEquals(783, kr.getError(0).getCode());
+        assertEquals("This query can't match anywhere", kr.getError(0)
+                .getMessage());
+    };
+
 
     /**
      * This is a Schreibgebrauch ressource that didn't work for