pages:load-view broken for any term search with no div or head in common ancestor with next page

Issue #77 new
Craig Berry created an issue

There are only lucene indexes on tei:div and tei:head and pages:load-view does not attempt to search anything else when attempting to retrieve search hits via ft:query. So when the ancestor of $model?data is any other element than tei:div or tei:head, and the ancestor of the following page is the same (such as two consecutive pages within tei:list) no data are retrieved and we get a cardinality error when calling pages:get-content with empty data.

An example would be the instance of "verrucarium" that occurs on page 017-b of Gerard's Herbal (A01622).

One possible solution would be to index and query for more than just div and head. Another option would be to be more restrictive about which common ancestors we look for, specifically in this code:

                if ($nextPage) then
                    ($model?data/ancestor::* intersect $nextPage/ancestor::*)[last()]