You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/search/includes/quickstarts/search-get-started-vector-javascript.md
+30-31Lines changed: 30 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,20 +38,6 @@ In the remaining sections, you set up API calls to Azure OpenAI and Azure AI Sea
38
38
39
39
1. On the **Overview** home page, copy the URL. An example endpoint might look like `https://example.search.windows.net`.
40
40
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
-
55
41
56
42
## Set up the Node.JS project
57
43
@@ -85,6 +71,15 @@ Set up project with Visual Studio Code and JavaScript.
85
71
mkdir src
86
72
```
87
73
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
+
```
88
83
## Sign in to Azure
89
84
90
85
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
108
103
109
104
1. Create a `createIndex.js` file in the `src` directory.
110
105
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`.
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
+
115
112
1. Run the file:
116
113
117
114
```console
118
-
node -r dotenv/config dist/createIndex.js
115
+
node -r dotenv/config src/createIndex.js
119
116
```
120
117
1. The output of this code shows that the index is created successfully:
121
118
@@ -135,7 +132,6 @@ In this section, you create a vector index in Azure AI Search with [SearchIndexC
135
132
- Vector search (enables hybrid search by collocating vector and nonvector fields) fields (`DescriptionVector` with `vectorSearchProfileName`)
136
133
- Semantic search
137
134
- Faceted search (`searchSuggester`)
138
-
- Semantic search
139
135
- Geo-spatial search (`Location` field with `geo.distance`)
140
136
- Filtering, sorting (Many fields marked filterable and sortable)
141
137
@@ -147,7 +143,7 @@ Creating and loading the index are separate steps. You created the index schema
147
143
In Azure AI Search, the index stores all searchable content, while the search engine executes queries against that index.
148
144
149
145
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.
@@ -216,7 +212,7 @@ The first example demonstrates a basic scenario where you want to find document
216
212
1. Build and run the file:
217
213
218
214
```console
219
-
node -r dotenv/config dist/searchSingle.js
215
+
node -r dotenv/config src/searchSingle.js
220
216
```
221
217
222
218
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
243
239
244
240
1. Create a `searchSingleWithFilter.js` file in the `src` directory.
245
241
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`.
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`.
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
301
300
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).
302
301
303
302
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`.
1. The output of this code shows the relevant documents for the hybrid search:
313
312
@@ -426,19 +425,19 @@ This search uses [SearchClient](/javascript/api/@azure/search-documents/searchcl
426
425
427
426
## Create a semantic hybrid search
428
427
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`.
430
429
431
430
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).
432
431
433
432
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`.
Copy file name to clipboardExpand all lines: articles/search/includes/quickstarts/search-get-started-vector-typescript.md
+23-22Lines changed: 23 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,19 +43,6 @@ In the remaining sections, you set up API calls to Azure OpenAI and Azure AI Sea
43
43
44
44
1. On the **Overview** home page, copy the URL. An example endpoint might look like `https://example.search.windows.net`.
45
45
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
-
```
59
46
60
47
61
48
## Set up the Node.JS project
@@ -121,6 +108,16 @@ Set up project with Visual Studio Code and TypeScript.
121
108
}
122
109
```
123
110
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
+
124
121
## Sign in to Azure
125
122
126
123
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
144
141
145
142
1. Create a `createIndex.ts` file in the `src` directory.
146
143
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`.
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
+
151
150
1. Build and run the file:
152
151
153
152
```console
@@ -171,7 +170,6 @@ In this section, you create a vector index in Azure AI Search with [SearchIndexC
171
170
- Vector search (enables hybrid search by collocating vector and nonvector fields) fields (`DescriptionVector` with `vectorSearchProfileName`)
172
171
- Semantic search
173
172
- Faceted search (`searchSuggester`)
174
-
- Semantic search
175
173
- Geo-spatial search (`Location` field with `geo.distance`)
176
174
- Filtering, sorting (Many fields marked filterable and sortable)
177
175
@@ -183,7 +181,7 @@ Creating and loading the index are separate steps. You created the index schema
183
181
In Azure AI Search, the index stores all searchable content, while the search engine executes queries against that index.
184
182
185
183
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.
@@ -279,9 +277,12 @@ You can add filters, but the filters are applied to the nonvector content in you
279
277
280
278
1. Create a `searchSingleWithFilter.ts` file in the `src` directory.
281
279
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`.
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
+
285
286
1. Build and run the file:
286
287
287
288
```console
@@ -305,7 +306,7 @@ You can specify a geospatial filter to limit results to a specific geographic ar
305
306
306
307
1. Create a `searchSingleWithFilterGeo.ts` file in the `src` directory.
307
308
308
-
1. Add the dependencies, environment variables, and search functionality with a geospatial filter.
@@ -337,7 +338,7 @@ Hybrid search consists of keyword queries and vector queries in a single search
337
338
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).
338
339
339
340
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`.
@@ -462,12 +463,12 @@ This search uses [SearchClient](/javascript/api/@azure/search-documents/searchcl
462
463
463
464
## Create a semantic hybrid search
464
465
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`.
466
467
467
468
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).
468
469
469
470
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`.
0 commit comments