Index: lucene/core/src/test/org/apache/lucene/search/spans/TestSpans.java =================================================================== --- lucene/core/src/test/org/apache/lucene/search/spans/TestSpans.java (revision 1622820) +++ lucene/core/src/test/org/apache/lucene/search/spans/TestSpans.java (working copy) @@ -313,7 +313,13 @@ assertTrue("Has next and it shouldn't", spans.next() == false); } - + public void testNearSpanMinOnePositionIncrement() throws IOException { + SpanQuery[] duplicateSpanTerms = new SpanQuery[] { makeSpanTermQuery("w1"), makeSpanTermQuery("w1")}; + + //Term w1 shouldn't count itself as a hit within a SpanNear. + checkHits(new SpanNearQuery(duplicateSpanTerms, 1, true), new int[]{}); + checkHits(new SpanNearQuery(duplicateSpanTerms, 1, false), new int[]{}); + } private Spans orSpans(String[] terms) throws Exception { SpanQuery[] sqa = new SpanQuery[terms.length];