Analyzes the query and marks optimizable expressions for the query engine. This class just searches for potentially optimizable expressions in the query tree and encloses those expressions with an (#exist:optimize#) pragma. The real optimization work is not done by this class but by the pragma (see {@link org.exist.xquery.pragmas.Optimize}). The pragma may also decide that the optimization is not applicable and just execute the expression without any optimization. Currently, the optimizer is disabled by default. To enable it, set attribute enable-query-rewriting to yes in conf.xml: <xquery enable-java-binding="no" enable-query-rewriting="yes">... To enable/disable the optimizer for a single query, use an option:
declare option exist:optimize "enable=yes|no";