The model is predicting all the related tags that the user's question can be in. Note that the tags need not to be mutually exclusive i.e., a question can belong to multiple (overlapping) tags (topics). and then, we are retrieving the top 5 most relevant documents corresponding to that user's query.
Data - https://archive.org/details/stackexchange
https://cloud.githubusercontent.com/assets/9404205/20704556/c0e5a0fc-b645-11e6-9194-5b3fa778f08f.jpg
https://cloud.githubusercontent.com/assets/9404205/20704750/7500cada-b646-11e6-8fc0-3d80417d3a1c.jpg
https://cloud.githubusercontent.com/assets/9404205/20704579/e0752082-b645-11e6-83b5-4e7ced569aff.jpg