diff --git a/src/test/org/apache/lucene/search/TestRemoteSearchable.java b/src/test/org/apache/lucene/search/TestRemoteSearchable.java index 6f565bb3ef3..33e77d9f8ea 100644 --- a/src/test/org/apache/lucene/search/TestRemoteSearchable.java +++ b/src/test/org/apache/lucene/search/TestRemoteSearchable.java @@ -79,7 +79,7 @@ public class TestRemoteSearchable extends TestCase { return lookupRemote(); } } - + private static Searchable lookupRemote() throws Exception { return (Searchable)Naming.lookup("//localhost/Searchable"); } @@ -101,7 +101,7 @@ public class TestRemoteSearchable extends TestCase { Naming.rebind("//localhost/Searchable", impl); } - public static void search(Query query) throws Exception { + private static void search(Query query) throws Exception { // try to search the published index Searchable[] searchables = { getRemote() }; Searcher searcher = new MultiSearcher(searchables); @@ -110,22 +110,35 @@ public class TestRemoteSearchable extends TestCase { assertEquals(1, result.length()); assertEquals("test text", result.doc(0).get("test")); } - - public void testTermQuery() throws Exception { + + public void testTermQuery() throws Exception { search(new TermQuery(new Term("test", "test"))); } - public void testBooleanQuery() throws Exception { + public void testBooleanQuery() throws Exception { BooleanQuery query = new BooleanQuery(); query.add(new TermQuery(new Term("test", "test")), true, false); search(query); } - public void testPhraseQuery() throws Exception { + public void testPhraseQuery() throws Exception { PhraseQuery query = new PhraseQuery(); query.add(new Term("test", "test")); query.add(new Term("test", "text")); search(query); } + // Tests bug fix at http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20290 + public void testQueryFilter() throws Exception { + // try to search the published index + Searchable[] searchables = { getRemote() }; + Searcher searcher = new MultiSearcher(searchables); + Hits hits = searcher.search( + new TermQuery(new Term("test", "text")), + new QueryFilter(new TermQuery(new Term("test", "test")))); + Hits nohits = searcher.search( + new TermQuery(new Term("test", "text")), + new QueryFilter(new TermQuery(new Term("test", "non-existent-term")))); + assertEquals(0, nohits.length()); + } }