Azure Search SDK for Blob Storage - Deleting Files -
i have created application lists documents in azure storage container, , lets user mark specific files delete.
this azure search application, process add "deleted" metadata property selected files, run indexer remove information index, , physically delete files.
here's code process:
serviceclient.indexers.run(documentindexer); var status = serviceclient.indexers.getstatus(documentindexer).lastresult.status; // loop until indexer done while (status == indexerexecutionstatus.inprogress) { status = serviceclient.indexers.getstatus(documentindexer).lastresult.status; } // if successful, delete flagged files if (status == indexerexecutionstatus.success) { deleteflagged(); }
everything works fine, if put breakpoint on deleteflagged() call, forcing delay between running indexer , deleting files.
without pause, indexer comes successful, , delete files, file contents haven't been removed index - still show in search results (the files have been physically deleted).
is there else need check before deleting?
when run indexer, doesn't instantly transition inprogress state - in fact, depending on how many indexers running in service, there may significant delay before indexer scheduled run. so, when call getstatus before loop, indexer may not inprogress yet, , end deleting blobs early. more reliable approach wait indexer complete particular run (e.g., looking @ lastresult's starttime/endtime).
Comments
Post a Comment