Extracted Index API.
Adapt to changes in Index API.
Merge branch '0.5.x' of https://github.com/substance/document into 0.5.x