apache / apache/lucene

Some more explanation improvements

Open
#16,267 0 comments 0 reactions 0 assignees View on GitHub
type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

A recent Explanation change I done, (#16229) has led me to more explanation improvements.

I am thinking of looking at the following:
1. [ ] Testing gap in testExplainFailingOptionalClauses. It only asserts on the failingOptionals list, not the main subs list. Adding a `subs.clear()` into BooleanWeight doesn't fail any tests.
- https://github.com/apache/lucene/pull/16509
2. [ ] CheckHits.checkNoMatchExplanations is shallow. It only checks the root explanation's isMatch() == false and never looks at its sub-details. Nested non-match sub-explanations are never structurally verified.
3. [x] Improve the KNN explain message. When testing #16229, we saw some unclear output, see below.
- PR merged: https://github.com/apache/lucene/pull/16271
```
0.0 = no match on optional clause (track(knn=DocAndScoreQuery[1404635,...][0.7655482,...],0.7655482))
0.0 = not in top 1 docs
```

4. [ ] TestComplexExplanations has a long-standing `// :TODO: we really need more crazy complex cases.`

Contributor guide

Open the contributing guide

Research direction

Choose one unchecked item first. Start with the named testExplainFailingOptionalClauses, CheckHits.checkNoMatchExplanations, or TestComplexExplanations entry point and inspect BooleanWeight where relevant; done means the tests cover the listed explanation structure or add the requested complex cases without weakening existing assertions.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search, testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.