Good point. It didn’t occur to me that changing the sorting would yield different results. But I still don’t understand why the search yields the results it yields. So here’s my thinking:
To start with, I assume that the “sort by” field is for, well, sorting whatever was found in a particular order, i.e. that it does not change what was found.
I also understand that discourse limits the maximum number of (displayed?) search results to 500 (up until earlier this year it was 50). So, I can see that, in principle, the displayed search results can differ because the top 500 may differ depending on the sorting criteria.
But! This is only the case if there is an actual 501st post that is being cut off. If there are only a few posts that contain the search string (as is the case in my example), then the displayed search results should be identical regardless of the sorting order. Discourse clearly is not doing that because in the OP example, the number of hits actually differs, depending on the sort order. I don’t understand it.
To put it in more UX terms: discourse says at the end of maybe two dozen hits: “No more results found” which is either trivial (because we’re at the end of the results list) or wrong (because there clearly are more posts containing the search term).
In the old days, when discourse limited the total number of hits and cut off everything below the top whatever-it-was, I can see But