index: add conditional encoding of text nodes