@@ -21,6 +21,7 @@ namespace EMPIShim
21
21
internal class AzureSearchEMPIShim : IEMPIProvider
22
22
{
23
23
private static string fsurl = Utils . GetEnvironmentVariable ( "FS-URL" ) ;
24
+ private string searchIndex = Environment . GetEnvironmentVariable ( "SEARCH_INDEX" ) ;
24
25
private static HttpClient _empiclient = new HttpClient ( ) ;
25
26
public async Task < MatchResult > RunMatch ( JObject criteria , ILogger log )
26
27
{
@@ -122,7 +123,6 @@ public async Task<MatchResult> RunMatch(JObject criteria, ILogger log)
122
123
123
124
// Create a new SearchIndexClient
124
125
SearchIndexClient indexClient = new SearchIndexClient ( endpoint , credential ) ;
125
- string searchIndex = Environment . GetEnvironmentVariable ( "SEARCH_INDEX" ) ; ;
126
126
SearchClient searchClient = indexClient . GetSearchClient ( searchIndex ) ;
127
127
searchOptions . IncludeTotalCount = true ;
128
128
searchOptions . QueryType = SearchQueryType . Full ;
@@ -225,7 +225,7 @@ public async Task UpdateEMPI(string eventType, JObject fhirresource, ILogger log
225
225
}
226
226
( ( JArray ) o [ "value" ] ) . Add ( fhirresource ) ;
227
227
log . LogInformation ( o . ToString ( Newtonsoft . Json . Formatting . Indented ) ) ;
228
- var url = Environment . GetEnvironmentVariable ( "SEARCH_ENDPOINT" ) + "/indexes/fhir-patient-index /docs/index?api-version=2023-11-01" ;
228
+ var url = Environment . GetEnvironmentVariable ( "SEARCH_ENDPOINT" ) + $ "/indexes/{ searchIndex } /docs/index?api-version=2023-11-01";
229
229
var empiRequest = new HttpRequestMessage ( HttpMethod . Post , url ) ;
230
230
empiRequest . Headers . Add ( "api-key" , Utils . GetEnvironmentVariable ( "SEARCH_API_KEY" ) ) ;
231
231
empiRequest . Headers . Accept . Add ( new MediaTypeWithQualityHeaderValue ( "application/json" ) ) ;
@@ -243,7 +243,7 @@ public async Task UpdateEMPI(string eventType, JObject fhirresource, ILogger log
243
243
deleteObj [ "@search.action" ] = "delete" ;
244
244
deleteObj [ "id" ] = fhirid ;
245
245
( ( JArray ) o1 [ "value" ] ) . Add ( deleteObj ) ;
246
- var url1 = Environment . GetEnvironmentVariable ( "SEARCH_ENDPOINT" ) + "/indexes/fhir-patient-index /docs/index?api-version=2023-11-01" ;
246
+ var url1 = Environment . GetEnvironmentVariable ( "SEARCH_ENDPOINT" ) + $ "/indexes/{ searchIndex } /docs/index?api-version=2023-11-01";
247
247
var empiRequest1 = new HttpRequestMessage ( HttpMethod . Post , url1 ) ;
248
248
empiRequest1 . Headers . Add ( "api-key" , Utils . GetEnvironmentVariable ( "SEARCH_API_KEY" ) ) ;
249
249
empiRequest1 . Headers . Accept . Add ( new MediaTypeWithQualityHeaderValue ( "application/json" ) ) ;
0 commit comments