apache / apache/lucene

FilterScorer to override more super-class methods [LUCENE-7683]

Open
#8,734 1 comment 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Minor type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

[Scorer.java](https://github.com/apache/lucene-solr/blob/master/lucene/core/src/java/org/apache/lucene/search/Scorer.java) has non-abstract non-final non-private non-static methods (getChildren, getWeight) which the [FilterScorer.java](https://github.com/apache/lucene-solr/blob/master/lucene/core/src/java/org/apache/lucene/search/FilterScorer.java) class does not override.

Proposed changes:
- Option 1: Add the missing methods.
- Option 2: Make the missing methods `final` in the non-Filter base class.
- Either way, add `TestFilterScorer.java` class similar to [TestFilterWeight.java](https://github.com/apache/lucene-solr/blob/master/lucene/core/src/test/org/apache/lucene/search/TestFilterWeight.java) class.

Optional bonus (as a separate patch?):
- TestFilterWeight, TestFilterCodecReader, TestMergePolicyWrapper and possibly other tests all have `implTestDeclaredMethodsOverridden(superClass, subClass, excusedMethods)` logic and some sort of [lucene/test-framework util](https://github.com/apache/lucene-solr/tree/master/lucene/test-framework/src/java/org/apache/lucene/util) FilterTestUtils.java class with a static implTestDeclaredMethodsOverridden method could perhaps be factored out.

---
Migrated from [LUCENE-7683](https://issues.apache.org/jira/browse/LUCENE-7683) by Christine Poerschke (@cpoerschke)
Linked issues:
- #8727

Contributor guide

Open the contributing guide

Research direction

Compare the non-abstract methods in lucene/core/src/java/org/apache/lucene/search/Scorer.java with lucene/core/src/java/org/apache/lucene/search/FilterScorer.java, then review lucene/core/src/test/org/apache/lucene/search/TestFilterWeight.java. Decide between adding overrides or making the base methods final, and add TestFilterScorer.java to verify the chosen behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search, testing
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.