Skip to main content
added 206 characters in body
Source Link
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60

Yes, you are explicitly telling it to sort on votes and it dutifully does so.

Drop the sort (or specify the default, activity) and the accepted answer will be listed at the top.

Drop the sort (or specify the default, activity) and the accepted answer will be listed at the top. see kevin's comments

Which brings up another interesting question, which I remember being discussed elsewhere but can't be bothered to search: how answers are shuffled around in the default sort.

If you have a monster question with 100's of answers and you use the default sort, which is somewhat random, no?, and page through, it seems that you are going to probably get unpredictable results.

So, the only way to reliably page through answers is to specify a non-default sort, which means that the accepted answer is not going to be pinned to the top of the list.

I don't see a simple way around this except to pull the accepted answer and manually add it to the head of the first page of results and omit it when encountered later in the paged operation.

but that is neither here nor there.

use accepted_answer_id to prefetch the accepted answer and insert it into the head of your list and ignore it if/when it comes around in results.

Yes, you are explicitly telling it to sort on votes and it dutifully does so.

Drop the sort (or specify the default, activity) and the accepted answer will be listed at the top.

Which brings up another interesting question, which I remember being discussed elsewhere but can't be bothered to search: how answers are shuffled around in the default sort.

If you have a monster question with 100's of answers and you use the default sort, which is somewhat random, no?, and page through, it seems that you are going to probably get unpredictable results.

So, the only way to reliably page through answers is to specify a non-default sort, which means that the accepted answer is not going to be pinned to the top of the list.

I don't see a simple way around this except to pull the accepted answer and manually add it to the head of the first page of results and omit it when encountered later in the paged operation.

but that is neither here nor there.

Yes, you are explicitly telling it to sort on votes and it dutifully does so.

Drop the sort (or specify the default, activity) and the accepted answer will be listed at the top. see kevin's comments

Which brings up another interesting question, which I remember being discussed elsewhere but can't be bothered to search: how answers are shuffled around in the default sort.

If you have a monster question with 100's of answers and you use the default sort, which is somewhat random, no?, and page through, it seems that you are going to probably get unpredictable results.

So, the only way to reliably page through answers is to specify a non-default sort, which means that the accepted answer is not going to be pinned to the top of the list.

I don't see a simple way around this except to pull the accepted answer and manually add it to the head of the first page of results and omit it when encountered later in the paged operation.

but that is neither here nor there.

use accepted_answer_id to prefetch the accepted answer and insert it into the head of your list and ignore it if/when it comes around in results.

Source Link
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60

Yes, you are explicitly telling it to sort on votes and it dutifully does so.

Drop the sort (or specify the default, activity) and the accepted answer will be listed at the top.

Which brings up another interesting question, which I remember being discussed elsewhere but can't be bothered to search: how answers are shuffled around in the default sort.

If you have a monster question with 100's of answers and you use the default sort, which is somewhat random, no?, and page through, it seems that you are going to probably get unpredictable results.

So, the only way to reliably page through answers is to specify a non-default sort, which means that the accepted answer is not going to be pinned to the top of the list.

I don't see a simple way around this except to pull the accepted answer and manually add it to the head of the first page of results and omit it when encountered later in the paged operation.

but that is neither here nor there.