1. A method of determining a flush point, comprising: receiving, with a computer including a processor, a query, wherein the query is formed by one or more paths, and wherein each path includes one or more steps, wherein a query structure represents the query, wherein the query structure includes query nodes, and wherein each of the query nodes is flagged with a FOR binding or a LET binding; receiving a hierarchical document including one or more document nodes; determining whether there is a parent axis in the query; in response to determining that there is no parent axis in the query, identifying a first query node in the query structure by traversing the query structure up from one or more extraction nodes and stopping at a first one of the query node flagged with the FOR binding from among the query nodes or a root node of the query structure; flagging the first query node as a flush candidate; identifying a second query node by traversing the query structure from the root node of the query structure downwards until finding the query node that is flagged with a FlushCandidate identifier or the query node that has more than one child from among the query nodes; and flagging the second query node as the flush point.
3. The method of claim 1 , further comprising: in response to determining that there is a parent axis in the query, identifying a third query node that is associated with a step that is previous to a previous step of the parent axis; and flagging the third node as the flush point.