code: func (q *Query) maybeRewrite(op QueryOp) {
  	if q.Op != QAnd && q.Op != QOr {
  		return
  	}
  
  	// AND/OR doing real work?  Can't rewrite.
  	n := len(q.Sub) + len(q.Trigram)
  	if n > 1 {
  		return
  	}
  
  	// Nothing left in the AND/OR?
  	if n == 0 {
  		if q.Op == QAnd {
  			q.Op = QAll
  		} else {
  			q.Op = QNone
  		}
  		return
  	}
  
  	// Just a sub-node: throw away wrapper.
  	if len(q.Sub) == 1 {
  		*q = *q.Sub[0]
  	}
  
  	// Just a trigram: can use either op.
  	q.Op = op
  }
docs: // maybeRewrite rewrites q to use op if it is possible to do so
  // without changing the meaning.  It also simplifies if the node
  // is an empty OR or AND.