code: func (h *handler) fetchDocumentFunc(blobs []blob.Ref,
  	searchFunc func([]blob.Ref) (*search.SearchResult, error)) (*document, error) {
  	res, err := searchFunc(blobs)
  	if err != nil {
  		return nil, err
  	}
  	if len(res.Blobs) < 1 {
  		return nil, os.ErrNotExist
  	}
  	if res.Describe == nil || len(res.Describe.Meta) == 0 {
  		return nil, errors.New("document permanode was not described")
  	}
  	for _, des := range res.Describe.Meta {
  		if des.Permanode == nil {
  			continue
  		}
  		doc, err := h.describeDocument(des)
  		if err != nil {
  			return nil, fmt.Errorf("error describing document %v: %v", des.BlobRef, err)
  		}
  		return doc, nil
  	}
  	return nil, os.ErrNotExist
  }
docs: // returns os.ErrNotExist when document was not found