index: handle empty DocumentFragments

Test case included.