diff --git a/src/java/org/apache/lucene/search/spans/NearSpansOrdered.java b/src/java/org/apache/lucene/search/spans/NearSpansOrdered.java
index 95451f4..3023b36 100644
--- a/src/java/org/apache/lucene/search/spans/NearSpansOrdered.java
+++ b/src/java/org/apache/lucene/search/spans/NearSpansOrdered.java
@@ -235,24 +235,23 @@ public class NearSpansOrdered extends Spans {
     return true;
   }
   
-  /** Check whether two Spans in the same document are ordered.
-   * @return true iff spans1 starts before spans2
-   *              or the spans start at the same position,
-   *              and spans1 ends before spans2.
+  /** Check whether two Spans in the same document are ordered and not overlapping.
+   * @return false iff spans2's start position is smaller than spans1's end position
    */
-  static final boolean docSpansOrdered(Spans spans1, Spans spans2) {
+  static final boolean docSpansOrderedNonOverlap(Spans spans1, Spans spans2) {
     assert spans1.doc() == spans2.doc() : "doc1 " + spans1.doc() + " != doc2 " + spans2.doc();
-    int start1 = spans1.start();
-    int start2 = spans2.start();
-    /* Do not call docSpansOrdered(int,int,int,int) to avoid invoking .end() : */
-    return (start1 == start2) ? (spans1.end() < spans2.end()) : (start1 < start2);
+    assert spans1.start() < spans1.end();
+    assert spans2.start() < spans2.end();
+    return spans1.end() <= spans2.start();
   }
 
-  /** Like {@link #docSpansOrdered(Spans,Spans)}, but use the spans
+  /** Like {@link #docSpansOrderedNonOverlap(Spans,Spans)}, but use the spans
    * starts and ends as parameters.
    */
-  private static final boolean docSpansOrdered(int start1, int end1, int start2, int end2) {
-    return (start1 == start2) ? (end1 < end2) : (start1 < start2);
+  private static final boolean docSpansOrderedNonOverlap(int start1, int end1, int start2, int end2) {
+    assert start1 < end1;
+    assert start2 < end2;
+    return end1 <= start2;
   }
 
   /** Order the subSpans within the same document by advancing all later spans
@@ -261,7 +260,7 @@ public class NearSpansOrdered extends Spans {
   private boolean stretchToOrder() throws IOException {
     matchDoc = subSpans[0].doc();
     for (int i = 1; inSameDoc && (i < subSpans.length); i++) {
-      while (! docSpansOrdered(subSpans[i-1], subSpans[i])) {
+      while (! docSpansOrderedNonOverlap(subSpans[i-1], subSpans[i])) {
         if (! subSpans[i].next()) {
           inSameDoc = false;
           more = false;
@@ -313,7 +312,7 @@ public class NearSpansOrdered extends Spans {
         } else {
           int ppStart = prevSpans.start();
           int ppEnd = prevSpans.end(); // Cannot avoid invoking .end()
-          if (! docSpansOrdered(ppStart, ppEnd, lastStart, lastEnd)) {
+          if (! docSpansOrderedNonOverlap(ppStart, ppEnd, lastStart, lastEnd)) {
             break; // Check remaining subSpans.
           } else { // prevSpans still before (lastStart, lastEnd)
             prevStart = ppStart;
diff --git a/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java b/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java
index 8c3f989..fba134b 100644
--- a/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java
+++ b/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java
@@ -63,7 +63,7 @@ public class NearSpansUnordered extends Spans {
     @Override
     protected final boolean lessThan(SpansCell spans1, SpansCell spans2) {
       if (spans1.doc() == spans2.doc()) {
-        return NearSpansOrdered.docSpansOrdered(spans1, spans2);
+        return docSpansOrdered(spans1, spans2);
       } else {
         return spans1.doc() < spans2.doc();
       }
@@ -233,6 +233,18 @@ public class NearSpansUnordered extends Spans {
     return more && (atMatch() ||  next());
   }
 
+  /** Check whether two Spans in the same document are ordered with possible overlap.
+   * @return true iff spans1 starts before spans2
+   *              or the spans start at the same position,
+   *              and spans1 ends before spans2.
+   */
+  static final boolean docSpansOrdered(Spans spans1, Spans spans2) {
+    assert spans1.doc() == spans2.doc() : "doc1 " + spans1.doc() + " != doc2 " + spans2.doc();
+    int start1 = spans1.start();
+    int start2 = spans2.start();
+    return (start1 == start2) ? (spans1.end() < spans2.end()) : (start1 < start2);
+  }
+
   private SpansCell min() { return queue.top(); }
 
   @Override
diff --git a/src/java/org/apache/lucene/search/spans/SpanNearQuery.java b/src/java/org/apache/lucene/search/spans/SpanNearQuery.java
index 7c7781c..5cf13dc 100644
--- a/src/java/org/apache/lucene/search/spans/SpanNearQuery.java
+++ b/src/java/org/apache/lucene/search/spans/SpanNearQuery.java
@@ -48,12 +48,15 @@ public class SpanNearQuery extends SpanQuery implements Cloneable {
 
   /** Construct a SpanNearQuery.  Matches spans matching a span from each
    * clause, with up to <code>slop</code> total unmatched positions between
-   * them.  * When <code>inOrder</code> is true, the spans from each clause
-   * must be * ordered as in <code>clauses</code>.
+   * them.
+   * <br>When <code>inOrder</code> is true, the spans from each clause
+   * must be in the same order as in <code>clauses</code> and must be non-overlapping.
+   * <br>When <code>inOrder</code> is false, the spans from each clause
+   * need not be ordered and may overlap.
    * @param clauses the clauses to find near each other
    * @param slop The slop value
    * @param inOrder true if order is important
-   * */
+   */
   public SpanNearQuery(SpanQuery[] clauses, int slop, boolean inOrder) {
     this(clauses, slop, inOrder, true);     
   }
diff --git a/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java b/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java
index 48a4b4f..2519193 100644
--- a/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java
+++ b/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java
@@ -82,6 +82,20 @@ public class TestNearSpansOrdered extends LuceneTestCase {
   protected SpanNearQuery makeQuery() {
     return makeQuery("w1","w2","w3",1,true);
   }
+
+  protected SpanNearQuery makeOverlappedQuery() {
+    return new SpanNearQuery(
+      new SpanQuery[] {
+        new SpanNearQuery(new SpanQuery[] {
+          new SpanTermQuery(new Term(FIELD, "w3")),
+            new SpanTermQuery(new Term(FIELD, "w5")) },
+            1,
+            true
+          ),
+          new SpanTermQuery(new Term(FIELD, "w4")) },
+          0,
+          true);
+  }
   
   public void testSpanNearQuery() throws Exception {
     SpanNearQuery q = makeQuery();
@@ -170,6 +184,11 @@ public class TestNearSpansOrdered extends LuceneTestCase {
     Scorer s = w.scorer(leave, true, false, leave.reader().getLiveDocs());
     assertEquals(1, s.advance(1));
   }
+
+  public void testOverlappedOrderedSpan()  throws Exception {
+    SpanNearQuery q = makeOverlappedQuery();
+    CheckHits.checkHits(random(), q, FIELD, searcher, new int[] {});
+  }
   
   /**
    * not a direct test of NearSpans, but a demonstration of how/when
@@ -182,5 +201,4 @@ public class TestNearSpansOrdered extends LuceneTestCase {
                + e.toString(),
                0.0f < e.getValue());
   }
-  
 }
