Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate Search (
https://hibernate.atlassian.net/browse/HSEARCH?atlOrigin=eyJpIjoiNGQ2NGM2...
) / Improvement (
https://hibernate.atlassian.net/browse/HSEARCH-4669?atlOrigin=eyJpIjoiNGQ...
) HSEARCH-4669 (
https://hibernate.atlassian.net/browse/HSEARCH-4669?atlOrigin=eyJpIjoiNGQ...
) Provide contextual information about the projection definition when it cannot be applied
to an index (
https://hibernate.atlassian.net/browse/HSEARCH-4669?atlOrigin=eyJpIjoiNGQ...
)
Issue Type: Improvement Assignee: Unassigned Components: mapper-pojo-base Created:
10/Aug/2022 02:56 AM Fix Versions: 6.2-backlog Priority: Major Reporter: Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
When, in a search query definition, someone calls.select(MyProjectionClass.class) , it’s
possible that this class’s @ProjectionConstructor references fields that don’t exist, or
are not projectable, and that will lead to an exception being thrown.
That exception includes all the necessary information about the problem to fix (field
name, why it cannot be targeted, etc.), but it lacks information about why that problem
occurred, i.e. which projection definition could not be applied exactly. That information
would be especially useful in the case of nested {{@ProjectionConstructor}}s.
Concretely, this would mean catching SearchException in
org.hibernate.search.mapper.pojo.search.definition.impl.PojoConstructorProjectionDefinition#apply
and throwing another SearchException with a message such as “Could not apply projection
constructor <name>: <message from the cause>”, (of course we’d also use the
caught exception as the cause). We may have to tune this a bit to avoid very complicated
messages when there are multiple levels of projection constructor nesting.
(
https://hibernate.atlassian.net/browse/HSEARCH-4669#add-comment?atlOrigin...
) Add Comment (
https://hibernate.atlassian.net/browse/HSEARCH-4669#add-comment?atlOrigin...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100204- sha1:2e7ea99 )