apache / apache/lucene

Remove declared IOException in LeafReader methods that should not be doing I/O

Open
#16,052 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Some APIs in LeafReader declared throws IOException even though, in Lucene’s own implementations they are actually not doing any I/O and probably should never do I/O. They provide quick access to some already load metadata for quickly decide if the index needs to be searched or not.

It is difficult to tell from a developer point of view which methods are doing I /O and which are not because everything throws IOException. Therefore the proposal here is to remove the declared IOException from methods that should not be doing I/O.

In particular I am thinking in this two methods, there might be more:

```java
public abstract PointValues getPointValues(String field);

public abstract Terms terms(String field);
```

This is changing a public API so it should be a lucene 11 change only.

Contributor guide

Open the contributing guide

Research direction

Start at the LeafReader declarations for getPointValues(String field) and terms(String field), then inspect Lucene's implementations and callers to identify other metadata-only methods that should not perform I/O. Check the Lucene 11 API compatibility requirements and ensure the chosen declarations and affected usages compile without IOException handling where it is no longer needed.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.