Skip to content

Commit c0534f3

Browse files
authored
Merge pull request #6663 from KarlErickson/karler-vector-search
add Java pivot to vector search quickstart
2 parents 9238787 + 4762ad8 commit c0534f3

File tree

5 files changed

+1530
-36
lines changed

5 files changed

+1530
-36
lines changed

articles/search/includes/quickstarts/search-get-started-vector-java.md

Lines changed: 1483 additions & 0 deletions
Large diffs are not rendered by default.

articles/search/includes/quickstarts/search-get-started-vector-javascript.md

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ In Azure AI Search, a [vector store](../../vector-store.md) has an index schema
1919
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
2020

2121
- An Azure AI Search service. [Create a service](../../search-create-service-portal.md) or [find an existing service](https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/CognitiveSearch) in your current subscription.
22+
- The `Search Index Data Contributor` role assigned at the scope of the service.
2223
- You can use a free search service for most of this quickstart, but we recommend the Basic tier or higher for larger data files.
2324
- To run the query example that invokes [semantic reranking](../../semantic-search-overview.md), your search service must be at the Basic tier or higher with [semantic ranker enabled](../../semantic-how-to-enable-disable.md).
2425

@@ -111,14 +112,14 @@ In this section, you create a vector index in Azure AI Search with [SearchIndexC
111112

112113
1. Run the file:
113114

114-
```console
115+
```bash
115116
node -r dotenv/config src/createIndex.js
116117
```
117118
1. The output of this code shows that the index is created successfully:
118119

119-
```console
120-
Using Azure Search endpoint: https://my-service.search.windows.net
121-
Using index name: hotels-vector-quickstart
120+
```output
121+
Using Azure Search endpoint: https://<search-service-name>.search.windows.net
122+
Using Azure Search index: <vector-index-name>
122123
Creating index...
123124
hotels-vector-quickstart created
124125
```
@@ -142,7 +143,7 @@ Creating and loading the index are separate steps. You created the index schema
142143

143144
In Azure AI Search, the index stores all searchable content, while the search engine executes queries against that index.
144145

145-
1. Create a `uploadDocuments.js` file in the `src` directory.
146+
1. Create an `uploadDocuments.js` file in the `src` directory.
146147
1. Copy the following code into the file.
147148

148149
:::code language="javascript" source="~/azure-search-javascript-samples/quickstart-vector-js/src/uploadDocuments.js" :::
@@ -153,12 +154,14 @@ In Azure AI Search, the index stores all searchable content, while the search en
153154
154155
1. Build and run the file:
155156
156-
```console
157+
```bash
157158
node -r dotenv/config src/uploadDocuments.js
158159
```
159160
1. The output of this code shows that the documents are indexed and ready for search:
160161
161-
```console
162+
```output
163+
Using Azure Search endpoint: https://<search-service-name>.search.windows.net
164+
Using Azure Search index: <vector-index-name>
162165
Uploading documents...
163166
Key: 1, Succeeded: true, ErrorMessage: none
164167
Key: 2, Succeeded: true, ErrorMessage: none
@@ -171,7 +174,7 @@ In Azure AI Search, the index stores all searchable content, while the search en
171174
All documents indexed successfully.
172175
```
173176
174-
Key takeaways about the upload_documents() method and this example:
177+
Key takeaways about the uploadDocuments() method and this example:
175178
176179
* Your code interacts with a specific search index hosted in your Azure AI Search service through the SearchClient, which is the main object provided by the @azure/search-documents package. The SearchClient provides access to index operations such as:
177180
* Data ingestion - uploadDocuments(), mergeDocuments(), deleteDocuments(), etc.
@@ -211,15 +214,15 @@ The first example demonstrates a basic scenario where you want to find document
211214
212215
1. Build and run the file:
213216
214-
```console
217+
```bash
215218
node -r dotenv/config src/searchSingle.js
216219
```
217220
218221
1. The output of this code shows the relevant docs for the query `quintessential lodging near running trails, eateries, retail`.
219222
220-
```console
221-
Using Azure Search endpoint: https://ai-search-dib-2.search.windows.net
222-
Using index name: hotels-vector-quickstart-0627-4
223+
```output
224+
Using Azure Search endpoint: https://<search-service-name>.search.windows.net
225+
Using Azure Search index: <vector-index-name>
223226
224227
225228
Single Vector search found 5
@@ -247,14 +250,14 @@ You can add filters, but the filters are applied to the nonvector content in you
247250
248251
1. Build and run the file:
249252
250-
```console
253+
```bash
251254
node -r dotenv/config src/searchSingleWithFilter.js
252255
```
253256
1. The output of this code shows the relevant documents for the query with the filter for `free wifi` applied:
254257
255-
```console
256-
Using Azure Search endpoint: https://ai-search-dib-2.search.windows.net
257-
Using index name: hotels-vector-quickstart-0627-4
258+
```output
259+
Using Azure Search endpoint: https://<search-service-name>.search.windows.net
260+
Using Azure Search index: <vector-index-name>
258261
259262
260263
Single Vector search found 2
@@ -273,15 +276,15 @@ You can specify a geospatial filter to limit results to a specific geographic ar
273276
:::code language="javascript" source="~/azure-search-javascript-samples/quickstart-vector-js/src/searchSingleWithFilterGeo.js" :::
274277
1. Build and run the file:
275278
276-
```console
279+
```bash
277280
node -r dotenv/config src/searchSingleWithFilterGeo.js
278281
```
279282
280283
1. The output of this code shows the relevant documents for the query with the geospatial post-processing exclusion filter applied:
281284
282-
```console
283-
Using Azure Search endpoint: https://ai-search-dib-2.search.windows.net
284-
Using index name: hotels-vector-quickstart-0627-4
285+
```output
286+
Using Azure Search endpoint: https://<search-service-name>.search.windows.net
287+
Using Azure Search index: <vector-index-name>
285288
286289
287290
Single Vector search found 2
@@ -305,14 +308,14 @@ This search uses [SearchClient](/javascript/api/@azure/search-documents/searchcl
305308
:::code language="javascript" source="~/azure-search-javascript-samples/quickstart-vector-js/src/searchHybrid.js" :::
306309
1. Build and run the file:
307310
308-
```console
311+
```bash
309312
node -r dotenv/config src/searchHybrid.js
310313
```
311314
1. The output of this code shows the relevant documents for the hybrid search:
312315
313-
```console
314-
Using Azure Search endpoint: https://ai-search-dib-2.search.windows.net
315-
Using index name: hotels-vector-quickstart-0627-4
316+
```output
317+
Using Azure Search endpoint: https://<search-service-name>.search.windows.net
318+
Using Azure Search index: <vector-index-name>
316319
317320
318321
Hybrid search found 7 then limited to top 5
@@ -417,7 +420,7 @@ This search uses [SearchClient](/javascript/api/@azure/search-documents/searchcl
417420
"@search.score": 0.8133763,
418421
"HotelId": "3",
419422
"HotelName": "Gastronomic Landscape Hotel",
420-
"Description": "The Hotel stands out for its gastronomic excellence under the management of William Dough, who advises on and oversees all of the Hotels restaurant services.",
423+
"Description": "The Hotel stands out for its gastronomic excellence under the management of William Dough, who advises on and oversees all of the Hotel's restaurant services.",
421424
"Category": "Resort and Spa"
422425
}
423426
]
@@ -436,15 +439,15 @@ This search uses [SearchClient](/javascript/api/@azure/search-documents/searchcl
436439
437440
1. Build and run the file:
438441
439-
```console
442+
```bash
440443
node -r dotenv/config src/searchSemanticHybrid.js
441444
```
442445
443446
1. The output of this code shows the relevant documents for the semantic hybrid search:
444447
445-
```console
446-
Using Azure Search endpoint: https://ai-search-dib-2.search.windows.net
447-
Using index name: hotels-vector-quickstart-0627-4
448+
```output
449+
Using Azure Search endpoint: https://<search-service-name>.search.windows.net
450+
Using Azure Search index: <vector-index-name>
448451
449452
450453
Semantic hybrid search found 7 then limited to top 5
@@ -480,7 +483,7 @@ This search uses [SearchClient](/javascript/api/@azure/search-documents/searchcl
480483
Re-ranker Score: 2.0582215785980225
481484
HotelId: 3
482485
HotelName: Gastronomic Landscape Hotel
483-
Description: The Gastronomic Hotel stands out for its culinary excellence under the management of William Dough, who advises on and oversees all of the Hotels restaurant services.
486+
Description: The Gastronomic Hotel stands out for its culinary excellence under the management of William Dough, who advises on and oversees all of the Hotel's restaurant services.
484487
Category: Suite
485488
```
486489
@@ -509,7 +512,7 @@ If you want to keep the search service, but delete the index and documents, you
509512
510513
1. Build and run the file:
511514
512-
```console
515+
```bash
513516
node -r dotenv/config src/deleteIndex.js
514517
```
515518

articles/search/includes/quickstarts/semantic-ranker-java.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ If you signed in to the [Azure portal](https://portal.azure.com), you're signed
8989

9090
## Create a common configuration class
9191

92-
Create a file in `src/main/java/com/azure/search/quickstart` called `SearchConfig.java` to read the properties file and hold the environment variables and authentication credential.
92+
Create a file in `src/main/java/com/azure/search/quickstart` called `SearchConfig.java` to read the properties file and hold the configuration values and authentication credential.
9393

9494
```java
9595
package com.azure.search.quickstart;
@@ -476,7 +476,7 @@ Optionally, you can add captions to extract portions of the text and apply hit h
476476
477477
1. Output should include a new caption element alongside search field. Captions are the most relevant passages in a result. If your index includes larger chunks of text, a caption is helpful for extracting the most interesting sentences.
478478
479-
```console
479+
```output
480480
Search result #1:
481481
Re-ranker Score: 2.613231658935547
482482
HotelName: Uptown Chic Hotel
@@ -604,7 +604,7 @@ To produce a semantic answer, the question and answer must be closely aligned, a
604604
605605
Recall that answers are *verbatim content* pulled from your index and might be missing phrases that a user would expect to see. To get *composed answers* as generated by a chat completion model, considering using a [RAG pattern](../../retrieval-augmented-generation-overview.md) or [agentic retrieval](../../search-agentic-retrieval-concept.md).
606606
607-
```console
607+
```output
608608
Semantic answer result #1:
609609
Semantic Answer: Nature is Home on the beach. Explore the shore by day, and then come home to our shared living space to relax around a stone fireplace, sip something warm, and explore the<em> library </em>by night. Save up to 30 percent. Valid Now through the end of the year. Restrictions and blackouts may apply.
610610
Semantic Answer Score: 0.9829999804496765

articles/search/search-get-started-vector.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ zone_pivot_groups: search-get-started-vector-search
2020

2121
::: zone-end
2222

23+
::: zone pivot="java"
24+
25+
[!INCLUDE [Java quickstart](includes/quickstarts/search-get-started-vector-java.md)]
26+
27+
::: zone-end
28+
2329
::: zone pivot="javascript"
2430

2531
[!INCLUDE [JavaScript quickstart](includes/quickstarts/search-get-started-vector-javascript.md)]

zone-pivots/zone-pivot-groups.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,12 +1561,14 @@ groups:
15611561
title: Programming languages
15621562
prompt: Choose a usage method
15631563
pivots:
1564+
- id: dotnet
1565+
title: C#
1566+
- id: java
1567+
title: Java
15641568
- id: javascript
15651569
title: JavaScript
15661570
- id: python
15671571
title: Python
1568-
- id: dotnet
1569-
title: C#
15701572
- id: rest
15711573
title: REST
15721574
- id: typescript

0 commit comments

Comments
 (0)