How to do a partial search on a row key in azure table storage?


New Member
I am using Azure table storage along with node js for a ticketing app. I am using the client's name as a partition key and ticket id as a row key. For example:
RowKey: {'_': 232344}
I want the row key to be a combination of ticketid and customer's phone number. Ex:
RowKey: {'_': 232344_9393944392} or RowKey: {'_': 2323449393944392}
and be able to do a partial search on row key using the customer's phone number and retrieve all tickets raised by a customer. How can I do it in node js?
The following code is how I am querying table storage.
const azure = require('azure-storage');
const query = new azure.TableQuery().where('PartitionKey eq ?',client).and('Rowkey eq?',ticketId);
This is where I am stuck as I do not how to do a partial search on the row key.


Thành viên BQT
There are two possible solutions:
  • Use Phone Number rather than Ticket Id as PartitionKey. If so, searching a phone number among tickets can be converted into a simple partition scan. This is a more efficient way.
  • Keep using Ticket Id as PartitionKey, and use RowKey format PhoneNumber_TicketId. If so, searching a phone number among tickets can be converted to a filter string such as RowKey ge '9393944392' and RowKey lt '9393944393', which is a full table scan since no PartitionKey is filtered in the string. This is a less efficient way since full table scan happens.

Từ khóa phổ biến

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.