Azure Search on blobs retrieve the blob itself after search

760 views Asked by At

How would I retrieve the actual blob (pdf) itself via azure search? I know there are some Lookup possibilities but these only give me text representation of the content. I want a pdf download/stream of the underlaying document. How would I go over this? Im using the .NET SDK.

Do I need to index the filename (to retrieve via blob storage directly)? And if so how?

1

There are 1 answers

0
Viking On BEST ANSWER

Answer is: just add a field called metadata_storage_path to your index! SDK:

new Field() { Name = "metadata_storage_path", Type = "Edm.String", IsSearchable = false, IsFilterable = false, IsSortable = false, IsFacetable = false }

A list of metadata properties you can add to your index is here: https://learn.microsoft.com/azure/search/search-howto-indexing-azure-blob-storage#how-azure-search-indexes-blobs

Alternatively, by default Azure Search populates the key field in your index with the URL-safe base64 encoded value of the metadata_storage_path property. You can decode the encoded blob path value (for details, see base64Decode mapping function and retrieve the blob.