A computer-implemented method for searching a corpus of documents includes defining a query as a twig including a root annotation operator having an associated tag specifying a span and having an associated expression indicative of one or more terms whose occurrence within the span will satisfy the query. An object is recursively selected from a group of objects that consists of the tag and the expression, and is used in advancing through the corpus until a candidate document is found that contains the tag and satisfies the expression. The candidate document is evaluated to determine whether the one or more terms indicated by the expression occur within the span in the candidate document so as to satisfy the annotation operator.