mirror of https://github.com/apache/lucene.git
test that IllegalArgumentException is thrown if terms belong to different fields
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150635 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c23bb571c3
commit
49ab2ff423
|
@ -122,5 +122,15 @@ public class TestMultiPhraseQuery
|
||||||
result = searcher.search(query3);
|
result = searcher.search(query3);
|
||||||
assertEquals(2, result.length()); // blueberry pizza, blueberry chewing gum
|
assertEquals(2, result.length()); // blueberry pizza, blueberry chewing gum
|
||||||
assertEquals("body:\"(blueberry bluebird) pizza\"", query3.toString());
|
assertEquals("body:\"(blueberry bluebird) pizza\"", query3.toString());
|
||||||
|
|
||||||
|
MultiPhraseQuery query4 = new MultiPhraseQuery();
|
||||||
|
try {
|
||||||
|
query4.add(new Term("field1", "foo"));
|
||||||
|
query4.add(new Term("field2", "foobar"));
|
||||||
|
fail();
|
||||||
|
} catch(IllegalArgumentException e) {
|
||||||
|
// okay, all terms must belong to the same field
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue