We're updating the issue view to help you get more done. 

SpatialFieldBridge uses inefficient Reflection access

Description

The strategy used by SpatialFieldBridge to read the coordinates is very inefficient, as it temptatively attempts a reflection call and then falls back to a second option.
The approach might be fine, but the attempt is performed for every single read of the Coordinates pair, generating a swallowed exception (with related stacktrace) each time an entity using @Spatial is indexed.

1 2 3 4 5 6 7 8 9 Stack Trace Count java.lang.Throwable.<init>(String) 17,731 java.lang.Exception.<init>(String) 17,731 java.lang.ReflectiveOperationException.<init>(String) 17,731 java.lang.NoSuchFieldException.<init>(String) 17,731 java.lang.Class.getField(String) 17,731 org.hibernate.search.spatial.SpatialFieldBridge.getCoordinateFromField(String, Object) 17,731 org.hibernate.search.spatial.SpatialFieldBridge.getLatitude(Object) 8,866 org.hibernate.search.spatial.SpatialFieldBridge.getLongitude(Object) 8,865

Environment

None

Status

Assignee

Yoann Rodière

Reporter

Sanne Grinovero

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Fix versions

Priority

Major