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.
Cool job Terry, thanks! I'm trying to review it (this is one of the scariest pieces of code in the Xindice codebase) before committing, but I'm having quite an hard time since running diff on your file just shows the whole source as changed, so I can't spot exactly where you did your changes (I understand it has to do with the new evalUnion() method...). Care to provide us a diff -u format of what you did, or even just explain us what changed?
TIA,
-- Gianugo Rabellino Pro-netics s.r.l. http://www.pro-netics.com