The order of documents in a response set

Is the order the Documents appear in the ResponseSet the same order that they appear in the Responses?

Anecdotally I have observed it to be, but I wanted to understand if I could expect it to be.

You should use the document_index field in the Response object to figure out which document is associated with a particular result.

message Response {
  string text = 5;
  float score = 10;
  repeated Attribute metadata = 20;
  uint32 document_index = 25;     // Pointer to the document in the ResponseSet.
  CorpusKey corpus_key = 30;
}

While it’s true that, generally, documents do appear in the same order as responses, there are exceptions. For example, multiple results coming from the same document will throw off the ordering.

Ahh, this is what I was wondering about, thank you!