Whenever a UNION operator ("|") is encountered in an XPath, the XPathQueryResolver gives up on using indexes to resolve the query and reverts to a collection scan. This can have horrible performance consequences for a large database even if the proper indexes are in place.
A suggested fix is to modify the XPathQueryResolver to perform UNION operation through an index OR operation. I filed a bug report (19024) describing this problem and attached a version of XPathQueryResolver modified to use indexes to resolve UNION operations.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19204
The fixed version of XPathQueryResolver is attached to the bug report if anyone with commit powers would care to take a look and perhaps commit it.
Sorry if it took so long: I just committed your patches, thanks for your work! Please crosscheck, and if everything works fine mark the bugzilla entry as FIXED, so that we might close it.
Just to let you know, in case you find something else to contribute, the easiest way to provide us a patch is to download source from CVS, make your modification, and send us the "cvs diff -u" output of the modified files. Anyway, I will gladly accept contributions in whatever format too, help is much appreciated. :-)
Ciao,
-- Gianugo Rabellino Pro-netics s.r.l. http://www.pro-netics.com