Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in tests replace deprecated IndexSearcher.doc() calls #3149

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

cpoerschke
Copy link
Contributor

The API is deprecated since Lucene 9.5 - https://github.com/apache/lucene/blob/releases/lucene/9.5.0/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java#L382-L391 -- and remove in Lucene 10.

So the replacement here can go to both main and branch_9x branches with no JIRA or solr/CHANGES.txt entry needed in my opinion.

@cpoerschke cpoerschke marked this pull request as ready for review January 31, 2025 15:28
Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a number (all?) places here, you have a SolrIndexSearcher so could call getDocFetcher().doc(id) which is the Solr way to do this, not calling storedFields(). I leave it to you to contemplate which path makes the most sense based on the test. But I think the solr-way is preferred unless the test is particularly low-level (like "uninverting" package.

@@ -183,12 +183,12 @@ private void testRange(int precisionStep) throws Exception {
ScoreDoc[] sd = topDocs.scoreDocs;
assertNotNull(sd);
assertEquals("Score doc count" + type, count, sd.length);
Document doc = searcher.doc(sd[0].doc);
Document doc = searcher.storedFields().document(sd[0].doc);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we have an IndexSearcher i.e. not a SolrIndexSearcher and so not using SolrIndexSearcher.getDocFetcher() here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants