MarcusSorealheis commented on PR #12208: URL: https://github.com/apache/lucene/pull/12208#issuecomment-1499406344
You're right again. Thanks for the help. The tests were the hardest part and taught me the most. On Thu, Apr 6, 2023 at 9:17 AM Patrick Zhai ***@***.***> wrote: > ***@***.**** commented on this pull request. > ------------------------------ > > In > lucene/sandbox/src/test/org/apache/lucene/sandbox/search/TestTermAutomatonQuery.java > <https://github.com/apache/lucene/pull/12208#discussion_r1160010214>: > > > + > + Directory dir = newDirectory(); > + RandomIndexWriter w = new RandomIndexWriter(random(), dir); > + Document doc = new Document(); > + doc.add(newTextField("field", "protobuf", Field.Store.NO)); > + w.addDocument(doc); > + > + IndexReader r = w.getReader(); > + IndexSearcher searcher = newSearcher(r); > + Query rewrite = q.rewrite(searcher); > + assertTrue(rewrite instanceof PhraseQuery); > + > + TopDocs topDocs = searcher.search(rewrite, 10); > + assertEquals(0, topDocs.totalHits.value); > + > + for (ScoreDoc scoreDoc : topDocs.scoreDocs) { > > Hey if you put this loop back you're still not exercising explain since > there's no document collected. > I think just put searcher.explain(rewrittenQuery, 0) should do the trick. > > — > Reply to this email directly, view it on GitHub > <https://github.com/apache/lucene/pull/12208#discussion_r1160010214>, or > unsubscribe > <https://github.com/notifications/unsubscribe-auth/AAR6TSEISE3TS5WNIENX7F3W73UCLANCNFSM6AAAAAAV6G6DXI> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> > -- Marcus Eagan -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org