Closed sekur closed 5 years ago
I'm considering making List
elements return a Map
instead of an Array
. This may potentially break prior get operations involving List
but seems that it may make more sense to directly expose the internal state already using Map when the property getter is used instead of transforming into an Array. @quantang - any thoughts?
Shall we have some way, such as an additional option or a function, to return the internal state for XPath? Returning an Array for a List element is intuitive for the external users. While I guess the intention of the "get" is different from the "find", if we can return the Map for "find" and return the Array for "get", that would be perfect.
Latest 0.22 branch fixes this issue.
Currently, the XPath.process performs a generic operation which is to collect all possible entities into an array first before performing predicate filtering. In the case where the predicate filter applies to a direct key match for a list item, we can short-circuit this process by using the
List
internal Map data to directly retrieve the list item instead of searching through the entire list for finding the match.Created as a separate enhancement for issue #73 reported by @quantang