Refactor topic_query.rb for better readability

- Available options are defined and validated
- Internal methods are now protected
- Renamed some variables to be more consistent