Last active
February 7, 2018 14:10
-
-
Save cmatskas/5eb6c277712e8f90a4ceb91e9405e121 to your computer and use it in GitHub Desktop.
Run Search Indexer manually
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Configuration; | |
using System.Net.Http; | |
public static async Task Run(TimerInfo myTimer, TraceWriter log) | |
{ | |
SearchServiceClient searchService = new SearchServiceClient( | |
searchServiceName: ConfigurationManager.AppSettings["SearchServiceName"];, | |
credentials: new SearchCredentials(ConfigurationManager.AppSettings["SearchServiceAdminApiKey"])); | |
var indexerName = ConfigurationManager.AppSettings["indexerName"]; | |
var exists = await searchService.Indexers.ExistsAsync(indexerName); | |
if (exists) | |
{ | |
await searchService.Indexers.RunAsync(indexerName); | |
log.Info($"Indexer {indexerName} was executed at: {DateTime.Now}"); | |
} | |
// call the next function to retrieve the deleted blobs | |
using (var client = new HttpClient()) | |
{ | |
await client.GetAsync("<AzureFunctionUri"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment