Index: CHANGES.txt
===================================================================
--- CHANGES.txt	(revision 794027)
+++ CHANGES.txt	(working copy)
@@ -378,6 +378,9 @@
 
 18. LUCENE-1718: Fix termInfosIndexDivisor to carry over to reopened
     readers (Mike McCandless)
+    
+19. LUCENE-1583: SpanOrQuery skipTo() doesn't always move forwards as Spans
+	documentation indicates it should.  (Moti Nisenson via Mark Miller)
 
 New features
 
Index: src/java/org/apache/lucene/search/spans/SpanOrQuery.java
===================================================================
--- src/java/org/apache/lucene/search/spans/SpanOrQuery.java	(revision 794032)
+++ src/java/org/apache/lucene/search/spans/SpanOrQuery.java	(working copy)
@@ -215,16 +215,21 @@
           if (queue == null) {
             return initSpanQueue(target);
           }
-
+  
+          boolean skipCalled = false;
           while (queue.size() != 0 && top().doc() < target) {
             if (top().skipTo(target)) {
               queue.adjustTop();
             } else {
               queue.pop();
             }
+            skipCalled = true;
           }
-
-          return queue.size() != 0;
+  
+          if (skipCalled) {
+            return queue.size() != 0;
+          }
+          return next();
         }
 
         public int doc() { return top().doc(); }
Index: src/test/org/apache/lucene/search/spans/TestSpans.java
===================================================================
--- src/test/org/apache/lucene/search/spans/TestSpans.java	(revision 794027)
+++ src/test/org/apache/lucene/search/spans/TestSpans.java	(working copy)
@@ -331,6 +331,22 @@
     assertFalse("final next", spans.next());
   }
   
+  public void testSpanOrMovesForward() throws Exception {
+    Spans spans = orSpans(new String[] {"w1", "xx"});
+
+    spans.next();
+    int doc = spans.doc();
+    assertEquals(0, doc);
+    
+    spans.skipTo(0);
+    doc = spans.doc();
+    
+    // according to Spans, a skipTo to the same doc or less
+    // should still call next() on the underlying Spans
+    assertEquals(1, doc);
+
+  }
+  
   public void testSpanOrDouble() throws Exception {
     Spans spans = orSpans(new String[] {"w5", "yy"});
     tstNextSpans(spans, 0, 4, 5);

