Search code examples
azureazure-cognitive-searchazure-search-.net-sdk

How to query search on Metadata_storage_path field in Azure Search


I am aware that metadata_storage_path is encoded with Base-64 and we can decrypt it in our code by retrieving results from the Azure Search

My Problem is that I wanted Azure Search to query upon paths present in metadata_storage_path

For e.g. lets say metadata_storage_path has values like <baseurl>/india/health or <baseurl>/pakistan/health in its decrypted form, I wanted to search with India text get the relavant files and data

How can I perform a query on the path.?


Solution

  • The issue with the previous answer is that metadata_storage_name is just a blob name (not the entire path) and therefore is not guaranteed to be unique, so it's not a safe primary key.

    A safer approach is to "rename" metadata_storage_path into a new field (say, "filename") using a field mapping. That field won't be encoded so it's convenient to retrieve, while the encoded metadata_storage_path will still be used for a (safely unique) primary key.