Make the call to asXXX() (asEntity, asReference) optional in the Search DSL

Description

Just to make the DSL less verbose, we should allow the mappers to specify a default "projection", so that we can write something like this:

1 2 3 4 return Search.getSearchSession(em).search(Book.class) .predicate(f -> f.simpleQueryString().onFields("title").matching(pattern)) .sort(f -> f.byField("title_sort")) .fetchHits();

And if the user really needs to change the projection, they can still call the asProjection method explicitly:

1 2 3 4 5 return Search.getSearchSession(em).search(Book.class) .asProjection(f -> ...) .predicate(f -> f.simpleQueryString().onFields("title").matching(pattern)) .sort(f -> f.byField("title_sort")) .fetchHits();

Environment

None

Status

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Fix versions

Priority

Major
Configure