Skip to content

fix: put back the convenience API consumers call - #46

Merged
marevol merged 1 commit into
mainfrom
fix/restore-consumer-api
Sep 14, 2026
Merged

marevol merged 1 commit into
mainfrom
fix/restore-consumer-api

Conversation

@marevol

@marevol marevol commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

The fork kept the widest constructor of several response types and dropped every
overload that delegates to it, plus two empty() factories. All of them are
public entry points in OpenSearch, and consumers call them.

fess hit this the moment main first compiled against the fork. A test that
builds a SearchResponse by hand needs four of them, and without them it has to
read like this:

new ShardSearchFailure(new IllegalStateException(reason), null)
new SearchHits(new SearchHit[0], new TotalHits(0, TotalHits.Relation.EQUAL_TO), 0)
new InternalSearchResponse(hits, null, null, null, timedOut, null, 1,
        Collections.emptyList(), Collections.emptyList())

— a caller that has no phaseTook, no point-in-time id and no search extensions
having to pass all of them and know what the right null is for each. Keeping only
the widest constructor saves nothing: the overloads are one delegating call each.

Restored

type members
SearchHits empty(), empty(boolean)
ShardSearchFailure ShardSearchFailure(Exception)
InternalSearchResponse empty(), empty(boolean), the 7- and 8-argument constructors
SearchResponse the 8- and 9-argument constructors

Each body is upstream's, unchanged. None adds state or behaviour; every one
delegates to a constructor that was already here.

Ordering

This needs to be published before codelibs/fess#3442 can go green. fess
main does not compile without it — that PR is otherwise only an import rename
and a dead-override removal.

Verification

The fork kept the widest constructor of each of these types and dropped the
overloads that delegate to it, along with two `empty()` factories. Every one of
them is a public entry point in OpenSearch, and a caller that has no `phaseTook`,
no point-in-time id and no search extensions has to pass them all explicitly and
know what the right null looks like.

Restored, byte-for-byte as upstream writes them:

- `SearchHits.empty()` / `empty(boolean)`
- `ShardSearchFailure(Exception)`
- `InternalSearchResponse.empty()` / `empty(boolean)`, and its 7- and 8-argument
  constructors
- `SearchResponse`'s 8- and 9-argument constructors

Each delegates; none adds state or behaviour.
@marevol marevol self-assigned this Sep 14, 2026
@marevol
marevol merged commit d9d5cbb into main Sep 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant