Vishal Sharma
Vishal Sharma

Reputation: 2803

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.?

Upvotes: 0

Views: 1661

Answers (2)

Eugene Shvets
Eugene Shvets

Reputation: 4671

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.

Upvotes: 4

Vishal Sharma
Vishal Sharma

Reputation: 2803

By default, If you create an index of azure storage it creates an Index on column metadata_storage_path , and that is the reason it is encoded , easiest way to avoid metadata_storage_path decoding is to switch the primary key to something else mostly metadata_storage_name.

Once you change it to something , metadata_storage_path will be available as a plain text

Hope this is useful.

Upvotes: 0

Related Questions