...
Note: if we wish to avoid creating additional database fields, using list/container name field would offer the best balance of performance, e.g.
id | parent_id | anchor_id | xpath | container |
---|---|---|---|---|
1 | NULL | 3 | /bookstore | bookstore |
2 | 1 | 3 | /bookstore/categories[@code='1'] | categories |
3 | 2 | 3 | /bookstore/categories[@code='1']/books[@title='Matilda'] | books |
4 | 2 | 3 | /bookstore/categories[@code='1']/books[@title='The Gruffalo'] | books |
In this case, attributes for any list element path component would need to be looked up (so it would no longer be index-only). My suspicion is that this would have better general performance than using xpath_component alone, but testing is needed to verify.
Work Breakdown for Implementation
...