How to implement fast search on Azure Blob?

前端 未结 3 1556
轻奢々
轻奢々 2021-01-21 12:57

I am done with writing the code to upload files (text files) to azure blob storage. Now I want to provide search based on text files content. For ex. If I search for \"Hello\" t

相关标签:
3条回答
  • 2021-01-21 13:42

    That is a very bad way to do it. It will be very slow. The best option for this is Azure Search. Search can now automatically index your blobs!

    0 讨论(0)
  • 2021-01-21 14:00
    // get blob data
    CloudBlob cloudBlob = blobContainer.GetBlobReference(blobName);
    string text = cloudBlob.DownloadText();
    

    Maybe downloading it in one go is faster than reading line by line in a loop?

    0 讨论(0)
  • 2021-01-21 14:02

    Your code is not bad. Find out where most time is spent. Probably network or CPU. For network, you are out of luck. For CPU you can parallelize.

    You are using culture-specific string processing. StringComparison.Ordinal is far less CPU intensive (like 10x). It has different semantics, though.

    0 讨论(0)
提交回复
热议问题