I'm looking into a way to extend search in documents, especially, Org files by ways of indexing them. In order to make the indexing more robust, it would be great to make it aware of different sections of a file. In Org files, in particular, it would make sense to look separately into headers, the pargraphs of text, comments and snippets of other documents (code, tables etc.)
Is there a way to extract this information as some data-structure?