mirror of https://github.com/apache/lucene.git
- Added testQueryFilter test for bug 20290
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20290 - Made search(Query) private. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150031 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bdcea5f2ed
commit
355e66eb34
|
@ -79,7 +79,7 @@ public class TestRemoteSearchable extends TestCase {
|
||||||
return lookupRemote();
|
return lookupRemote();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Searchable lookupRemote() throws Exception {
|
private static Searchable lookupRemote() throws Exception {
|
||||||
return (Searchable)Naming.lookup("//localhost/Searchable");
|
return (Searchable)Naming.lookup("//localhost/Searchable");
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public class TestRemoteSearchable extends TestCase {
|
||||||
Naming.rebind("//localhost/Searchable", impl);
|
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
|
// try to search the published index
|
||||||
Searchable[] searchables = { getRemote() };
|
Searchable[] searchables = { getRemote() };
|
||||||
Searcher searcher = new MultiSearcher(searchables);
|
Searcher searcher = new MultiSearcher(searchables);
|
||||||
|
@ -110,22 +110,35 @@ public class TestRemoteSearchable extends TestCase {
|
||||||
assertEquals(1, result.length());
|
assertEquals(1, result.length());
|
||||||
assertEquals("test text", result.doc(0).get("test"));
|
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")));
|
search(new TermQuery(new Term("test", "test")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBooleanQuery() throws Exception {
|
public void testBooleanQuery() throws Exception {
|
||||||
BooleanQuery query = new BooleanQuery();
|
BooleanQuery query = new BooleanQuery();
|
||||||
query.add(new TermQuery(new Term("test", "test")), true, false);
|
query.add(new TermQuery(new Term("test", "test")), true, false);
|
||||||
search(query);
|
search(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPhraseQuery() throws Exception {
|
public void testPhraseQuery() throws Exception {
|
||||||
PhraseQuery query = new PhraseQuery();
|
PhraseQuery query = new PhraseQuery();
|
||||||
query.add(new Term("test", "test"));
|
query.add(new Term("test", "test"));
|
||||||
query.add(new Term("test", "text"));
|
query.add(new Term("test", "text"));
|
||||||
search(query);
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue