Skip to content

Commit

Permalink
use doc fetcher instead in two tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cpoerschke committed Jan 31, 2025
1 parent dfe7783 commit aa5ac10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ public void testNotLazyField() throws IOException {
core.execute(core.getRequestHandler(req.getParams().get(CommonParams.QT)), req, rsp);

DocList dl = ((ResultContext) rsp.getResponse()).getDocList();
Document d = req.getSearcher().storedFields().document(dl.iterator().nextDoc());
Document d = req.getSearcher().getDocFetcher().doc(dl.iterator().nextDoc());
// ensure field in fl is not lazy
assertNotEquals("LazyField", ((Field) d.getField("test_hlt")).getClass().getSimpleName());
assertNotEquals("LazyField", ((Field) d.getField("title")).getClass().getSimpleName());
Expand Down Expand Up @@ -791,7 +791,7 @@ public void testLazyField() throws IOException {

DocList dl = ((ResultContext) rsp.getResponse()).getDocList();
DocIterator di = dl.iterator();
Document d1 = req.getSearcher().storedFields().document(di.nextDoc());
Document d1 = req.getSearcher().getDocFetcher().doc(di.nextDoc());
IndexableField[] values1 = null;

// ensure fl field is non lazy, and non-fl field is lazy
Expand All @@ -813,7 +813,7 @@ public void testLazyField() throws IOException {

dl = ((ResultContext) rsp.getResponse()).getDocList();
di = dl.iterator();
Document d2 = req.getSearcher().storedFields().document(di.nextDoc());
Document d2 = req.getSearcher().getDocFetcher().doc(di.nextDoc());
// ensure same doc, same lazy field now
assertSame("Doc was not cached", d1, d2);
IndexableField[] values2 = d2.getFields("test_hlt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void test() throws Exception {
assertQ(req("q", "101", "df", ID_FLD, "fl", ID_FLD)); // eager load ID_FLD; rest are lazy

// fetch the document; we know it will be from the documentCache, docId 0
final Document d = h.getCore().withSearcher(searcher -> searcher.storedFields().document(0));
final Document d = h.getCore().withSearcher(searcher -> searcher.getDocFetcher().doc(0));

assertEager(d, ID_FLD);
assertLazyNotLoaded(d, LAZY_FIELD);
Expand Down

0 comments on commit aa5ac10

Please sign in to comment.