Skip to content

Commit f40edaa

Browse files
committed
edits
1 parent f464400 commit f40edaa

File tree

2 files changed

+53
-53
lines changed

2 files changed

+53
-53
lines changed

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

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,6 @@ In the remaining sections, you set up API calls to Azure OpenAI and Azure AI Sea
3838

3939
1. On the **Overview** home page, copy the URL. An example endpoint might look like `https://example.search.windows.net`.
4040

41-
1. [Find your Azure OpenAI service](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.CognitiveServices%2Faccounts).
42-
43-
1. On the **Overview** home page, select the link to view the endpoints. Copy the URL. An example endpoint might look like `https://example.openai.azure.com/`.
44-
45-
## Set up environment variables for local development
46-
47-
1. Create a `.env` file.
48-
1. Add the following environment variables to the `.env` file, replacing the values with your own service endpoints and keys.
49-
50-
```plaintext
51-
AZURE_SEARCH_ENDPOINT=<YOUR AZURE AI SEARCH ENDPOINT>
52-
AZURE_SEARCH_INDEX_NAME=hotels-sample-index
53-
```
54-
5541

5642
## Set up the Node.JS project
5743

@@ -85,6 +71,15 @@ Set up project with Visual Studio Code and JavaScript.
8571
mkdir src
8672
```
8773

74+
## Set up environment variables for local development
75+
76+
1. Create a `.env` file in your `vector-quickstart` project directory.
77+
1. Add the following environment variables to the `.env` file, replacing the values with your own service endpoints and keys.
78+
79+
```plaintext
80+
AZURE_SEARCH_ENDPOINT=<YOUR AZURE AI SEARCH ENDPOINT>
81+
AZURE_SEARCH_INDEX_NAME=hotels-vector-quickstart
82+
```
8883
## Sign in to Azure
8984

9085
You're using Microsoft Entra ID and role assignments for the connection. Make sure you're logged in to the same tenant and subscription as Azure AI Search and Azure OpenAI. You can use the Azure CLI on the command line to show current properties, change properties, and to sign in. For more information, see [Connect without keys](../../search-get-started-rbac.md).
@@ -108,14 +103,16 @@ In this section, you create a vector index in Azure AI Search with [SearchIndexC
108103

109104
1. Create a `createIndex.js` file in the `src` directory.
110105

111-
1. Add the dependencies, environment variables, and JavaScript type for `HotelDocument` to the top of the file. Add the `createIndex` function to create the index. The function defines the index schema, including the vector field `DescriptionVector`.
106+
1. Copy the following code into the file.
112107

113108
:::code language="javascript" source="~/azure-search-javascript-samples/quickstart-vector-js/src/createIndex.js":::
114109

110+
The code file adds the dependencies, environment variables, and JavaScript type for `HotelDocument` to the top of the file. Add the `createIndex` function to create the index. The function defines the index schema, including the vector field `DescriptionVector`.
111+
115112
1. Run the file:
116113

117114
```console
118-
node -r dotenv/config dist/createIndex.js
115+
node -r dotenv/config src/createIndex.js
119116
```
120117
1. The output of this code shows that the index is created successfully:
121118

@@ -135,7 +132,6 @@ In this section, you create a vector index in Azure AI Search with [SearchIndexC
135132
- Vector search (enables hybrid search by collocating vector and nonvector fields) fields (`DescriptionVector` with `vectorSearchProfileName`)
136133
- Semantic search
137134
- Faceted search (`searchSuggester`)
138-
- Semantic search
139135
- Geo-spatial search (`Location` field with `geo.distance`)
140136
- Filtering, sorting (Many fields marked filterable and sortable)
141137

@@ -147,7 +143,7 @@ Creating and loading the index are separate steps. You created the index schema
147143
In Azure AI Search, the index stores all searchable content, while the search engine executes queries against that index.
148144

149145
1. Create a `uploadDocuments.js` file in the `src` directory.
150-
1. Add the dependencies, environment variables, and functions to upload documents to the index.
146+
1. Copy the following code into the file.
151147

152148
:::code language="javascript" source="~/azure-search-javascript-samples/quickstart-vector-js/src/uploadDocuments.js" :::
153149

@@ -158,7 +154,7 @@ In Azure AI Search, the index stores all searchable content, while the search en
158154
1. Build and run the file:
159155

160156
```console
161-
node -r dotenv/config dist/uploadDocuments.js
157+
node -r dotenv/config src/uploadDocuments.js
162158
```
163159
1. The output of this code shows that the documents are indexed and ready for search:
164160

@@ -205,7 +201,7 @@ The first example demonstrates a basic scenario where you want to find document
205201

206202
1. Create a `searchSingle.js` file in the `src` directory.
207203

208-
1. Add the dependencies, environment variables, and search functionality.
204+
1. Copy the following code into the file.
209205

210206
:::code language="javascript" source="~/azure-search-javascript-samples/quickstart-vector-js/src/searchSingle.js" :::
211207

@@ -216,7 +212,7 @@ The first example demonstrates a basic scenario where you want to find document
216212
1. Build and run the file:
217213

218214
```console
219-
node -r dotenv/config dist/searchSingle.js
215+
node -r dotenv/config src/searchSingle.js
220216
```
221217

222218
1. The output of this code shows the relevant docs for the query `quintessential lodging near running trails, eateries, retail`.
@@ -243,13 +239,16 @@ You can add filters, but the filters are applied to the nonvector content in you
243239

244240
1. Create a `searchSingleWithFilter.js` file in the `src` directory.
245241

246-
1. Add the dependencies, environment variables, and the same search functionality as the previous search with a post-processing exclusion filter added for hotels with `free wifi`.
242+
1. Copy the following code into the file.
247243

248244
:::code language="javascript" source="~/azure-search-javascript-samples/quickstart-vector-js/src/searchSingleWithFilter.js" :::
245+
246+
Add the dependencies, environment variables, and the same search functionality as the previous search with a post-processing exclusion filter added for hotels with `free wifi`.
247+
249248
1. Build and run the file:
250249

251250
```console
252-
node -r dotenv/config dist/searchSingleWithFilter.js
251+
node -r dotenv/config src/searchSingleWithFilter.js
253252
```
254253
1. The output of this code shows the relevant documents for the query with the filter for `free wifi` applied:
255254

@@ -269,13 +268,13 @@ You can specify a geospatial filter to limit results to a specific geographic ar
269268

270269
1. Create a `searchSingleWithFilterGeo.js` file in the `src` directory.
271270

272-
1. Add the dependencies, environment variables, and search functionality with a geospatial filter.
271+
1. Copy the following code into the file.
273272

274273
:::code language="javascript" source="~/azure-search-javascript-samples/quickstart-vector-js/src/searchSingleWithFilterGeo.js" :::
275274
1. Build and run the file:
276275

277276
```console
278-
node -r dotenv/config dist/searchSingleWithFilterGeo.js
277+
node -r dotenv/config src/searchSingleWithFilterGeo.js
279278
```
280279

281280
1. The output of this code shows the relevant documents for the query with the geospatial post-processing exclusion filter applied:
@@ -301,13 +300,13 @@ Hybrid search consists of keyword queries and vector queries in a single search
301300
This search uses [SearchClient](/javascript/api/@azure/search-documents/searchclient).[search](/javascript/api/@azure/search-documents/searchclient#@azure-search-documents-searchclient-search) and the [VectorQuery](/javascript/api/@azure/search-documents/vectorquery) and [SearchOptions](/javascript/api/@azure/search-documents/searchoptions).
302301

303302
1. Create a `searchHybrid.js` file in the `src` directory.
304-
1. Add the dependencies, environment variables, and search functionality for a hybrid search with the additional search text `historic hotel walk to restaurants and shopping`.
303+
1. Copy the following code into the file.
305304

306305
:::code language="javascript" source="~/azure-search-javascript-samples/quickstart-vector-js/src/searchHybrid.js" :::
307306
1. Build and run the file:
308307

309308
```console
310-
node -r dotenv/config dist/searchHybrid.js
309+
node -r dotenv/config src/searchHybrid.js
311310
```
312311
1. The output of this code shows the relevant documents for the hybrid search:
313312

@@ -426,19 +425,19 @@ This search uses [SearchClient](/javascript/api/@azure/search-documents/searchcl
426425

427426
## Create a semantic hybrid search
428427

429-
Here's the last query in the collection.
428+
Here's the last query in the collection to create extend the semantic hybrid search with the additional search text `historic hotel walk to restaurants and shopping`.
430429

431430
This search uses [SearchClient](/javascript/api/@azure/search-documents/searchclient).[search](/javascript/api/@azure/search-documents/searchclient#@azure-search-documents-searchclient-search) and the [VectorQuery](/javascript/api/@azure/search-documents/vectorquery) and [SearchOptions](/javascript/api/@azure/search-documents/searchoptions).
432431

433432
1. Create a `searchSemanticHybrid.js` file in the `src` directory.
434-
1. Add the dependencies, environment variables, and search functionality for a semantic hybrid search with the additional search text `historic hotel walk to restaurants and shopping`.
433+
1. Copy the following code into the file.
435434

436435
:::code language="javascript" source="~/azure-search-javascript-samples/quickstart-vector-js/src/searchSemanticHybrid.js" :::
437436

438437
1. Build and run the file:
439438

440439
```console
441-
node -r dotenv/config dist/searchSemanticHybrid.js
440+
node -r dotenv/config src/searchSemanticHybrid.js
442441
```
443442

444443
1. The output of this code shows the relevant documents for the semantic hybrid search:
@@ -511,7 +510,7 @@ If you want to keep the search service, but delete the index and documents, you
511510
1. Build and run the file:
512511

513512
```console
514-
node -r dotenv/config dist/deleteIndex.js
513+
node -r dotenv/config src/deleteIndex.js
515514
```
516515

517516
## Next steps

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

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,6 @@ In the remaining sections, you set up API calls to Azure OpenAI and Azure AI Sea
4343

4444
1. On the **Overview** home page, copy the URL. An example endpoint might look like `https://example.search.windows.net`.
4545

46-
1. [Find your Azure OpenAI service](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.CognitiveServices%2Faccounts).
47-
48-
1. On the **Overview** home page, select the link to view the endpoints. Copy the URL. An example endpoint might look like `https://example.openai.azure.com/`.
49-
50-
## Set up environment variables for local development
51-
52-
1. Create a `.env` file.
53-
1. Add the following environment variables to the `.env` file, replacing the values with your own service endpoints and keys.
54-
55-
```plaintext
56-
AZURE_SEARCH_ENDPOINT=<YOUR AZURE AI SEARCH ENDPOINT>
57-
AZURE_SEARCH_INDEX_NAME=hotels-sample-index
58-
```
5946

6047

6148
## Set up the Node.JS project
@@ -121,6 +108,16 @@ Set up project with Visual Studio Code and TypeScript.
121108
}
122109
```
123110

111+
## Set up environment variables for local development
112+
113+
1. Create a `.env` file in your `vector-quickstart` project directory.
114+
1. Add the following environment variables to the `.env` file, replacing the values with your own service endpoints and keys.
115+
116+
```plaintext
117+
AZURE_SEARCH_ENDPOINT=<YOUR AZURE AI SEARCH ENDPOINT>
118+
AZURE_SEARCH_INDEX_NAME=hotels-vector-quickstart
119+
```
120+
124121
## Sign in to Azure
125122

126123
You're using Microsoft Entra ID and role assignments for the connection. Make sure you're logged in to the same tenant and subscription as Azure AI Search and Azure OpenAI. You can use the Azure CLI on the command line to show current properties, change properties, and to sign in. For more information, see [Connect without keys](../../search-get-started-rbac.md).
@@ -144,10 +141,12 @@ In this section, you create a vector index in Azure AI Search with [SearchIndexC
144141

145142
1. Create a `createIndex.ts` file in the `src` directory.
146143

147-
1. Add the dependencies, environment variables, and TypeScript type for `HotelDocument` to the top of the file. Add the `createIndex` function to create the index. The function defines the index schema, including the vector field `DescriptionVector`.
144+
1. Copy the following code into the file.
148145

149146
:::code language="typescript" source="~/azure-search-javascript-samples/quickstart-vector-ts/src/createIndex.ts":::
150147

148+
The code file adds the dependencies, environment variables, and JavaScript type for `HotelDocument` to the top of the file. Add the `createIndex` function to create the index. The function defines the index schema, including the vector field `DescriptionVector`.
149+
151150
1. Build and run the file:
152151

153152
```console
@@ -171,7 +170,6 @@ In this section, you create a vector index in Azure AI Search with [SearchIndexC
171170
- Vector search (enables hybrid search by collocating vector and nonvector fields) fields (`DescriptionVector` with `vectorSearchProfileName`)
172171
- Semantic search
173172
- Faceted search (`searchSuggester`)
174-
- Semantic search
175173
- Geo-spatial search (`Location` field with `geo.distance`)
176174
- Filtering, sorting (Many fields marked filterable and sortable)
177175

@@ -183,7 +181,7 @@ Creating and loading the index are separate steps. You created the index schema
183181
In Azure AI Search, the index stores all searchable content, while the search engine executes queries against that index.
184182

185183
1. Create a `uploadDocuments.ts` file in the `src` directory.
186-
1. Add the dependencies, environment variables, and functions to upload documents to the index.
184+
1. Copy the following code into the file.
187185

188186
:::code language="typescript" source="~/azure-search-javascript-samples/quickstart-vector-ts/src/uploadDocuments.ts" :::
189187

@@ -241,7 +239,7 @@ The first example demonstrates a basic scenario where you want to find document
241239

242240
1. Create a `searchSingle.ts` file in the `src` directory.
243241

244-
1. Add the dependencies, environment variables, and search functionality.
242+
1. Copy the following code into the file.
245243

246244
:::code language="typescript" source="~/azure-search-javascript-samples/quickstart-vector-ts/src/searchSingle.ts" :::
247245

@@ -279,9 +277,12 @@ You can add filters, but the filters are applied to the nonvector content in you
279277

280278
1. Create a `searchSingleWithFilter.ts` file in the `src` directory.
281279

282-
1. Add the dependencies, environment variables, and the same search functionality as the previous search with a post-processing exclusion filter added for hotels with `free wifi`.
280+
1. Copy the following code into the file.
283281

284282
:::code language="typescript" source="~/azure-search-javascript-samples/quickstart-vector-ts/src/searchSingleWithFilter.ts" :::
283+
284+
Add the dependencies, environment variables, and the same search functionality as the previous search with a post-processing exclusion filter added for hotels with `free wifi`.
285+
285286
1. Build and run the file:
286287

287288
```console
@@ -305,7 +306,7 @@ You can specify a geospatial filter to limit results to a specific geographic ar
305306

306307
1. Create a `searchSingleWithFilterGeo.ts` file in the `src` directory.
307308

308-
1. Add the dependencies, environment variables, and search functionality with a geospatial filter.
309+
1. Copy the following code into the file.
309310

310311
:::code language="typescript" source="~/azure-search-javascript-samples/quickstart-vector-ts/src/searchSingleWithFilterGeo.ts" :::
311312
1. Build and run the file:
@@ -337,7 +338,7 @@ Hybrid search consists of keyword queries and vector queries in a single search
337338
This search uses [SearchClient](/javascript/api/@azure/search-documents/searchclient).[search](/javascript/api/@azure/search-documents/searchclient#@azure-search-documents-searchclient-search) and the [VectorQuery](/javascript/api/@azure/search-documents/vectorquery) and [SearchOptions](/javascript/api/@azure/search-documents/searchoptions).
338339

339340
1. Create a `searchHybrid.ts` file in the `src` directory.
340-
1. Add the dependencies, environment variables, and search functionality for a hybrid search with the additional search text `historic hotel walk to restaurants and shopping`.
341+
1. Copy the following code into the file.
341342

342343
:::code language="typescript" source="~/azure-search-javascript-samples/quickstart-vector-ts/src/searchHybrid.ts" :::
343344
1. Build and run the file:
@@ -462,12 +463,12 @@ This search uses [SearchClient](/javascript/api/@azure/search-documents/searchcl
462463

463464
## Create a semantic hybrid search
464465

465-
Here's the last query in the collection.
466+
Here's the last query in the collection to create extend the semantic hybrid search with the additional search text `historic hotel walk to restaurants and shopping`.
466467

467468
This search uses [SearchClient](/javascript/api/@azure/search-documents/searchclient).[search](/javascript/api/@azure/search-documents/searchclient#@azure-search-documents-searchclient-search) and the [VectorQuery](/javascript/api/@azure/search-documents/vectorquery) and [SearchOptions](/javascript/api/@azure/search-documents/searchoptions).
468469

469470
1. Create a `searchSemanticHybrid.ts` file in the `src` directory.
470-
1. Add the dependencies, environment variables, and search functionality for a semantic hybrid search with the additional search text `historic hotel walk to restaurants and shopping`.
471+
1. Copy the following code into the file.
471472

472473
:::code language="typescript" source="~/azure-search-javascript-samples/quickstart-vector-ts/src/searchSemanticHybrid.ts" :::
473474

0 commit comments

Comments
 (0)