Add a method to help with filter/field iteration

- Add explanatory comments
Also this is the only function that uses the term "id field", which is an internal htslib concept. We either need to explain what an id field is in the documentation, or give this function a more generic name like field_index_end()