Search code examples
azureazure-search-.net-sdk

Azure Search: Create hyperlink on blob metadata path


In my azure search, I am using blob storage as my data source. Using the "metadata_storage_path", I am able to display the link in my search results(not clickable). However, how do I make the result in a hyperlink. Better yet, how do I make the "metadata_storage_name" into a hyperlink that will open the file in the path.

I am able to achieve the earlier results in the Azure portal itself.


Solution

  • the output from Azure Cognitive Search (former Azure Search) is a json document. It's up to your front end to display the content the way you want. Using JQuery would be something like this:

    $.each(data, function(i, item) {
        var dv = "<div><a href='" + item["metadata_storage_name"] + "'>link text</a></div>";
        $(dv).appendTo("body");
    });