mirror of https://github.com/apache/lucene.git
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:
parent
df6894f7ad
commit
edde3b691a
|
@ -138,7 +138,7 @@ public class TestMultiSearcher extends TestCase
|
||||||
searchers2[0] = new IndexSearcher(indexStoreB);
|
searchers2[0] = new IndexSearcher(indexStoreB);
|
||||||
searchers2[1] = new IndexSearcher(indexStoreA);
|
searchers2[1] = new IndexSearcher(indexStoreA);
|
||||||
// creating the mulitSearcher
|
// creating the mulitSearcher
|
||||||
Searcher mSearcher2 = getMultiSearcherInstance(searchers2);
|
MultiSearcher mSearcher2 = getMultiSearcherInstance(searchers2);
|
||||||
// performing the same search
|
// performing the same search
|
||||||
Hits hits2 = mSearcher2.search(query);
|
Hits hits2 = mSearcher2.search(query);
|
||||||
|
|
||||||
|
@ -151,6 +151,17 @@ public class TestMultiSearcher extends TestCase
|
||||||
}
|
}
|
||||||
mSearcher2.close();
|
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
|
// scenario 3
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue