My question is, would it be hard to detect a `[text() = X]` predicate and turn it into a `db:text()` query as suggested by Fabrice?
This should already happen. Did you have a look at the compiled query (GUI: Info View; Command Line: -V; Option: QUERYINFO)?
Feel free to provide me the XML data you are working with. Christian
In my case that optimization would turn
/descendant::tei:orth [text() = "arci"] [ancestor-or-self::* [@xml:lang][1][starts-with(@xml:lang, "san")] ] /parent::tei:form/parent::*[self::tei:entry | self::tei:re]
into
db:text('collection', 'arci')/ parent::tei:orth [ancestor-or-self::* [@xml:lang][1][(starts-with(@xml:lang, "san"))] ] /parent::tei:form/parent::*[self::tei:entry or self::tei:re]
by hoisting the `text()` comparison and inverting the direction of the axis, from `parent::` to `descendant::`.
It would be nice to be able to write to two queries that look almost the same but one uses `text() = X` while the other uses `contains(text(), X)` and have BaseX optimize them in different ways (db:text vs. full text search). :)
If you want I can send you the data privately.
Regards,
-- Gioele Barabucci <gioele@svario.it.