there was no test case for subSearcher() -> adding at least a simple one

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@505038 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2007-02-08 21:12:49 +00:00
parent df6894f7ad
commit edde3b691a
1 changed files with 12 additions and 1 deletions

View File

@ -138,7 +138,7 @@ public class TestMultiSearcher extends TestCase
searchers2[0] = new IndexSearcher(indexStoreB);
searchers2[1] = new IndexSearcher(indexStoreA);
// creating the mulitSearcher
Searcher mSearcher2 = getMultiSearcherInstance(searchers2);
MultiSearcher mSearcher2 = getMultiSearcherInstance(searchers2);
// performing the same search
Hits hits2 = mSearcher2.search(query);
@ -151,6 +151,17 @@ public class TestMultiSearcher extends TestCase
}
mSearcher2.close();
// test the subSearcher() method:
Query subSearcherQuery = parser.parse("id:doc1");
hits2 = mSearcher2.search(subSearcherQuery);
assertEquals(2, hits2.length());
assertEquals(0, mSearcher2.subSearcher(hits2.id(0))); // hit from searchers2[0]
assertEquals(1, mSearcher2.subSearcher(hits2.id(1))); // hit from searchers2[1]
subSearcherQuery = parser.parse("id:doc2");
hits2 = mSearcher2.search(subSearcherQuery);
assertEquals(1, hits2.length());
assertEquals(1, mSearcher2.subSearcher(hits2.id(0))); // hit from searchers2[1]
//--------------------------------------------------------------------
// scenario 3
//--------------------------------------------------------------------