Skip to content

Commit 68b71ed

Browse files
authored
Merge pull request #2953 from eric-urban/eur/full-text-qs-entra-java
java quickstart with microsoft entra id run and then explain
2 parents 882f10f + cfe1bba commit 68b71ed

9 files changed

+577
-356
lines changed

articles/search/includes/quickstarts/full-text-csharp.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,21 @@ AzureKeyCredential credential = new AzureKeyCredential("<Your search service adm
108108
//AzureKeyCredential credential = new AzureKeyCredential("Your search service admin key");
109109
110110
// Create a SearchIndexClient to send create/delete index commands
111-
SearchIndexClient adminClient = new SearchIndexClient(serviceEndpoint, credential);
111+
SearchIndexClient searchIndexClient = new SearchIndexClient(serviceEndpoint, credential);
112112
113113
// Create a SearchClient to load and query documents
114114
string indexName = "hotels-quickstart";
115-
SearchClient srchclient = new SearchClient(serviceEndpoint, indexName, credential);
115+
SearchClient searchClient = new SearchClient(serviceEndpoint, indexName, credential);
116116
117117
// Delete index if it exists
118118
Console.WriteLine("{0}", "Deleting index...\n");
119-
DeleteIndexIfExists(indexName, adminClient);
119+
DeleteIndexIfExists(indexName, searchIndexClient);
120120
121121
// Create index
122122
Console.WriteLine("{0}", "Creating index...\n");
123-
CreateIndex(indexName, adminClient);
123+
CreateIndex(indexName, searchIndexClient);
124124
125-
SearchClient ingesterClient = adminClient.GetSearchClient(indexName);
125+
SearchClient ingesterClient = searchIndexClient.GetSearchClient(indexName);
126126
127127
// Load documents
128128
Console.WriteLine("{0}", "Uploading documents...\n");
@@ -134,23 +134,23 @@ AzureKeyCredential credential = new AzureKeyCredential("<Your search service adm
134134
135135
// Call the RunQueries method to invoke a series of queries
136136
Console.WriteLine("Starting queries...\n");
137-
RunQueries(srchclient);
137+
RunQueries(searchClient);
138138
139139
// End the program
140140
Console.WriteLine("{0}", "Complete. Press any key to end this program...\n");
141141
Console.ReadKey();
142142
}
143143
144144
// Delete the hotels-quickstart index to reuse its name
145-
private static void DeleteIndexIfExists(string indexName, SearchIndexClient adminClient)
145+
private static void DeleteIndexIfExists(string indexName, SearchIndexClient searchIndexClient)
146146
{
147-
adminClient.GetIndexNames();
147+
searchIndexClient.GetIndexNames();
148148
{
149-
adminClient.DeleteIndex(indexName);
149+
searchIndexClient.DeleteIndex(indexName);
150150
}
151151
}
152152
// Create hotels-quickstart index
153-
private static void CreateIndex(string indexName, SearchIndexClient adminClient)
153+
private static void CreateIndex(string indexName, SearchIndexClient searchIndexClient)
154154
{
155155
FieldBuilder fieldBuilder = new FieldBuilder();
156156
var searchFields = fieldBuilder.Build(typeof(Hotel));
@@ -160,7 +160,7 @@ AzureKeyCredential credential = new AzureKeyCredential("<Your search service adm
160160
var suggester = new SearchSuggester("sg", new[] { "HotelName", "Category", "Address/City", "Address/StateProvince" });
161161
definition.Suggesters.Add(suggester);
162162
163-
adminClient.CreateOrUpdateIndex(definition);
163+
searchIndexClient.CreateOrUpdateIndex(definition);
164164
}
165165
166166
// Upload documents in a single Upload request.
@@ -266,7 +266,7 @@ AzureKeyCredential credential = new AzureKeyCredential("<Your search service adm
266266
}
267267
268268
// Run queries, use WriteDocuments to print output
269-
private static void RunQueries(SearchClient srchclient)
269+
private static void RunQueries(SearchClient searchClient)
270270
{
271271
SearchOptions options;
272272
SearchResults<Hotel> response;
@@ -285,7 +285,7 @@ AzureKeyCredential credential = new AzureKeyCredential("<Your search service adm
285285
options.Select.Add("HotelName");
286286
options.Select.Add("Rating");
287287
288-
response = srchclient.Search<Hotel>("*", options);
288+
response = searchClient.Search<Hotel>("*", options);
289289
WriteDocuments(response);
290290
291291
// Query 2
@@ -301,7 +301,7 @@ AzureKeyCredential credential = new AzureKeyCredential("<Your search service adm
301301
options.Select.Add("HotelName");
302302
options.Select.Add("Rating");
303303
304-
response = srchclient.Search<Hotel>("hotels", options);
304+
response = searchClient.Search<Hotel>("hotels", options);
305305
WriteDocuments(response);
306306
307307
// Query 3
@@ -316,7 +316,7 @@ AzureKeyCredential credential = new AzureKeyCredential("<Your search service adm
316316
options.Select.Add("HotelName");
317317
options.Select.Add("Tags");
318318
319-
response = srchclient.Search<Hotel>("pool", options);
319+
response = searchClient.Search<Hotel>("pool", options);
320320
WriteDocuments(response);
321321
322322
// Query 4 - Use Facets to return a faceted navigation structure for a given query
@@ -334,22 +334,22 @@ AzureKeyCredential credential = new AzureKeyCredential("<Your search service adm
334334
options.Select.Add("HotelName");
335335
options.Select.Add("Category");
336336
337-
response = srchclient.Search<Hotel>("*", options);
337+
response = searchClient.Search<Hotel>("*", options);
338338
WriteDocuments(response);
339339
340340
// Query 5
341341
Console.WriteLine("Query #5: Look up a specific document...\n");
342342
343343
Response<Hotel> lookupResponse;
344-
lookupResponse = srchclient.GetDocument<Hotel>("3");
344+
lookupResponse = searchClient.GetDocument<Hotel>("3");
345345
346346
Console.WriteLine(lookupResponse.Value.HotelId);
347347
348348
349349
// Query 6
350350
Console.WriteLine("Query #6: Call Autocomplete on HotelName...\n");
351351
352-
var autoresponse = srchclient.Autocomplete("sa", "sg");
352+
var autoresponse = searchClient.Autocomplete("sa", "sg");
353353
WriteDocuments(autoresponse);
354354
355355
}
@@ -651,11 +651,11 @@ static void Main(string[] args)
651651
//AzureKeyCredential credential = new AzureKeyCredential("Your search service admin key");
652652
653653
// Create a SearchIndexClient to send create/delete index commands
654-
SearchIndexClient adminClient = new SearchIndexClient(serviceEndpoint, credential);
654+
SearchIndexClient searchIndexClient = new SearchIndexClient(serviceEndpoint, credential);
655655
656656
// Create a SearchClient to load and query documents
657657
string indexName = "hotels-quickstart";
658-
SearchClient srchclient = new SearchClient(serviceEndpoint, indexName, credential);
658+
SearchClient searchClient = new SearchClient(serviceEndpoint, indexName, credential);
659659
660660
// REDACTED FOR BREVITY . . .
661661
}
@@ -685,7 +685,7 @@ In *Program.cs*, you create a [SearchIndex](/dotnet/api/azure.search.documents.i
685685
686686
```csharp
687687
// Create hotels-quickstart index
688-
private static void CreateIndex(string indexName, SearchIndexClient adminClient)
688+
private static void CreateIndex(string indexName, SearchIndexClient searchIndexClient)
689689
{
690690
FieldBuilder fieldBuilder = new FieldBuilder();
691691
var searchFields = fieldBuilder.Build(typeof(Hotel));
@@ -695,7 +695,7 @@ private static void CreateIndex(string indexName, SearchIndexClient adminClient)
695695
var suggester = new SearchSuggester("sg", new[] { "HotelName", "Category", "Address/City", "Address/StateProvince" });
696696
definition.Suggesters.Add(suggester);
697697
698-
adminClient.CreateOrUpdateIndex(definition);
698+
searchIndexClient.CreateOrUpdateIndex(definition);
699699
}
700700
```
701701
@@ -741,10 +741,10 @@ private static void UploadDocuments(SearchClient searchClient)
741741
742742
Once you initialize the [IndexDocumentsBatch](/dotnet/api/azure.search.documents.models.indexdocumentsbatch-1) object, you can send it to the index by calling [IndexDocuments](/dotnet/api/azure.search.documents.searchclient.indexdocuments) on your [SearchClient](/dotnet/api/azure.search.documents.searchclient) object.
743743
744-
You load documents using SearchClient in `Main()`, but the operation also requires admin rights on the service, which is typically associated with SearchIndexClient. One way to set up this operation is to get SearchClient through `SearchIndexClient` (`adminClient` in this example).
744+
You load documents using SearchClient in `Main()`, but the operation also requires admin rights on the service, which is typically associated with SearchIndexClient. One way to set up this operation is to get SearchClient through `SearchIndexClient` (`searchIndexClient` in this example).
745745
746746
```csharp
747-
SearchClient ingesterClient = adminClient.GetSearchClient(indexName);
747+
SearchClient ingesterClient = searchIndexClient.GetSearchClient(indexName);
748748
749749
// Load documents
750750
Console.WriteLine("{0}", "Uploading documents...\n");
@@ -796,11 +796,11 @@ private static void WriteDocuments(AutocompleteResults autoResults)
796796
797797
#### Query example 1
798798
799-
The `RunQueries` method executes queries and returns results. Results are Hotel objects. This sample shows the method signature and the first query. This query demonstrates the Select parameter that lets you compose the result using selected fields from the document.
799+
The `RunQueries` method executes queries and returns results. Results are Hotel objects. This sample shows the method signature and the first query. This query demonstrates the `Select` parameter that lets you compose the result using selected fields from the document.
800800
801801
```csharp
802802
// Run queries, use WriteDocuments to print output
803-
private static void RunQueries(SearchClient srchclient)
803+
private static void RunQueries(SearchClient searchClient)
804804
{
805805
SearchOptions options;
806806
SearchResults<Hotel> response;
@@ -819,7 +819,7 @@ private static void RunQueries(SearchClient srchclient)
819819
options.Select.Add("HotelName");
820820
options.Select.Add("Address/City");
821821
822-
response = srchclient.Search<Hotel>("*", options);
822+
response = searchClient.Search<Hotel>("*", options);
823823
WriteDocuments(response);
824824
// REDACTED FOR BREVITY
825825
}
@@ -843,7 +843,7 @@ options.Select.Add("HotelId");
843843
options.Select.Add("HotelName");
844844
options.Select.Add("Rating");
845845
846-
response = srchclient.Search<Hotel>("hotels", options);
846+
response = searchClient.Search<Hotel>("hotels", options);
847847
WriteDocuments(response);
848848
```
849849
@@ -863,7 +863,7 @@ options.Select.Add("HotelId");
863863
options.Select.Add("HotelName");
864864
options.Select.Add("Tags");
865865
866-
response = srchclient.Search<Hotel>("pool", options);
866+
response = searchClient.Search<Hotel>("pool", options);
867867
WriteDocuments(response);
868868
```
869869
@@ -886,7 +886,7 @@ options.Select.Add("HotelId");
886886
options.Select.Add("HotelName");
887887
options.Select.Add("Category");
888888
889-
response = srchclient.Search<Hotel>("*", options);
889+
response = searchClient.Search<Hotel>("*", options);
890890
WriteDocuments(response);
891891
```
892892
@@ -899,7 +899,7 @@ In the fifth query, return a specific document. A document lookup is a typical r
899899
Console.WriteLine("Query #5: Look up a specific document...\n");
900900
901901
Response<Hotel> lookupResponse;
902-
lookupResponse = srchclient.GetDocument<Hotel>("3");
902+
lookupResponse = searchClient.GetDocument<Hotel>("3");
903903
904904
Console.WriteLine(lookupResponse.Value.HotelId);
905905
```
@@ -912,7 +912,7 @@ The last query shows the syntax for autocomplete, simulating a partial user inpu
912912
// Query 6
913913
Console.WriteLine("Query #6: Call Autocomplete on HotelName that starts with 'sa'...\n");
914914
915-
var autoresponse = srchclient.Autocomplete("sa", "sg");
915+
var autoresponse = searchClient.Autocomplete("sa", "sg");
916916
WriteDocuments(autoresponse);
917917
```
918918

0 commit comments

Comments
 (0)