mirror of https://github.com/apache/lucene.git
test slop
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150638 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ac7576a81c
commit
a637ff56b3
|
@ -53,6 +53,7 @@ public class TestMultiPhraseQuery extends TestCase
|
|||
add("blueberry pizza", writer);
|
||||
add("blueberry chewing gum", writer);
|
||||
add("bluebird pizza", writer);
|
||||
add("bluebird foobar pizza", writer);
|
||||
add("piccadilly circus", writer);
|
||||
writer.optimize();
|
||||
writer.close();
|
||||
|
@ -108,6 +109,11 @@ public class TestMultiPhraseQuery extends TestCase
|
|||
assertEquals(2, result.length()); // blueberry pizza, bluebird pizza
|
||||
assertEquals("body:\"(blueberry bluebird) pizza\"", query3.toString());
|
||||
|
||||
// test slop:
|
||||
query3.setSlop(1);
|
||||
result = searcher.search(query3);
|
||||
assertEquals(3, result.length()); // blueberry pizza, bluebird pizza, bluebird foobar pizza
|
||||
|
||||
MultiPhraseQuery query4 = new MultiPhraseQuery();
|
||||
try {
|
||||
query4.add(new Term("field1", "foo"));
|
||||
|
@ -117,6 +123,9 @@ public class TestMultiPhraseQuery extends TestCase
|
|||
// okay, all terms must belong to the same field
|
||||
}
|
||||
|
||||
searcher.close();
|
||||
indexStore.close();
|
||||
|
||||
}
|
||||
|
||||
private void add(String s, IndexWriter writer) throws IOException
|
||||
|
|
Loading…
Reference in New Issue