Fix inherited queries when accessing cursor by index

Now the document class will be set correctly in code like this::

    doc = cursor[3]
Updated unit test
Merge pull request #148 from asivokon/master

Inherited queries are now supported when accessing cursor by index