|
1 | 1 | ---
|
2 |
| -author: haileytap |
| 2 | +author: diberry |
3 | 3 | ms.author: haileytapia
|
4 | 4 | ms.service: azure-ai-search
|
5 | 5 | ms.custom:
|
@@ -109,45 +109,45 @@ If you signed in to the [Azure portal](https://portal.azure.com), you're signed
|
109 | 109 |
|
110 | 110 | ## Create a common authentication file
|
111 | 111 |
|
112 |
| -1. Create a file in `./src` called `config.ts` to hold the environment variables and authentication credential. Copy in the following code. This file will be used by all the other files in this quickstart. |
113 |
| - |
114 |
| - ```typescript |
115 |
| - import { DefaultAzureCredential } from "@azure/identity"; |
116 |
| - |
117 |
| - // Configuration - use environment variables |
118 |
| - export const searchEndpoint = process.env.AZURE_SEARCH_ENDPOINT || "PUT-YOUR-SEARCH-SERVICE-ENDPOINT-HERE"; |
119 |
| - export const indexName = process.env.AZURE_SEARCH_INDEX_NAME || "hotels-sample-index"; |
120 |
| - export const semanticConfigurationName = process.env.SEMANTIC_CONFIGURATION_NAME || "semantic-config"; |
121 |
| - |
122 |
| - // Create credential |
123 |
| - export const credential = new DefaultAzureCredential(); |
124 |
| - |
125 |
| - console.log(`Using Azure Search endpoint: ${searchEndpoint}`); |
126 |
| - console.log(`Using index name: ${indexName}\n\n`); |
127 |
| - |
128 |
| - // Hotel document interface |
129 |
| - export interface HotelDocument { |
130 |
| - "@search.action"?: string; |
131 |
| - HotelId: string; |
132 |
| - HotelName: string; |
133 |
| - Description: string; |
134 |
| - Category: string; |
135 |
| - Tags: string[]; |
136 |
| - ParkingIncluded: string; |
137 |
| - LastRenovationDate: string; |
138 |
| - Rating: number; |
139 |
| - Address: { |
140 |
| - StreetAddress: string; |
141 |
| - City: string; |
142 |
| - StateProvince: string; |
143 |
| - PostalCode: string; |
144 |
| - Country: string; |
145 |
| - }; |
146 |
| - } |
147 |
| - ``` |
148 |
| -
|
149 |
| -
|
150 |
| -## Get configuration for the index |
| 112 | +Create a file in `./src` called `config.ts` to read the `.env` file and hold the environment variables and authentication credential. Copy in the following code; don't change it. This file will be used by all the other files in this quickstart. |
| 113 | +
|
| 114 | +```typescript |
| 115 | +import { DefaultAzureCredential } from "@azure/identity"; |
| 116 | +
|
| 117 | +// Configuration - use environment variables |
| 118 | +export const searchEndpoint = process.env.AZURE_SEARCH_ENDPOINT || "PUT-YOUR-SEARCH-SERVICE-ENDPOINT-HERE"; |
| 119 | +export const indexName = process.env.AZURE_SEARCH_INDEX_NAME || "hotels-sample-index"; |
| 120 | +export const semanticConfigurationName = process.env.SEMANTIC_CONFIGURATION_NAME || "semantic-config"; |
| 121 | +
|
| 122 | +// Create credential |
| 123 | +export const credential = new DefaultAzureCredential(); |
| 124 | +
|
| 125 | +console.log(`Using Azure Search endpoint: ${searchEndpoint}`); |
| 126 | +console.log(`Using index name: ${indexName}\n\n`); |
| 127 | +
|
| 128 | +// Hotel document interface |
| 129 | +export interface HotelDocument { |
| 130 | + "@search.action"?: string; |
| 131 | + HotelId: string; |
| 132 | + HotelName: string; |
| 133 | + Description: string; |
| 134 | + Category: string; |
| 135 | + Tags: string[]; |
| 136 | + ParkingIncluded: string; |
| 137 | + LastRenovationDate: string; |
| 138 | + Rating: number; |
| 139 | + Address: { |
| 140 | + StreetAddress: string; |
| 141 | + City: string; |
| 142 | + StateProvince: string; |
| 143 | + PostalCode: string; |
| 144 | + Country: string; |
| 145 | + }; |
| 146 | +} |
| 147 | +``` |
| 148 | +
|
| 149 | +
|
| 150 | +## Get the index schema |
151 | 151 |
|
152 | 152 | In this section, you get settings for the existing `hotels-sample-index` index on your search service.
|
153 | 153 |
|
@@ -193,8 +193,6 @@ In this section, you get settings for the existing `hotels-sample-index` index o
|
193 | 193 | npm run build && node -r dotenv/config dist/getIndexSettings.js
|
194 | 194 | ```
|
195 | 195 |
|
196 |
| -1. The output |
197 |
| -
|
198 | 196 | 1. Output is the name of the index, list of fields, and a statement indicating whether a semantic configuration exists. For the purposes of this quickstart, the message should say `No semantic configuration exists for this index`.
|
199 | 197 |
|
200 | 198 | ## Update the index with a semantic configuration
|
@@ -430,7 +428,7 @@ To produce a semantic answer, the question and answer must be closely aligned, a
|
430 | 428 | credential
|
431 | 429 | );
|
432 | 430 |
|
433 |
| - const results = await searchClient.search("walking distance to live music", { |
| 431 | + const results = await searchClient.search("What's a good hotel for people who like to read", { |
434 | 432 | queryType: "semantic",
|
435 | 433 | semanticSearchOptions: {
|
436 | 434 | configurationName: semanticConfigurationName,
|
@@ -499,6 +497,6 @@ To produce a semantic answer, the question and answer must be closely aligned, a
|
499 | 497 |
|
500 | 498 | ```console
|
501 | 499 | Semantic answer result #1:
|
502 |
| - Semantic Answer: All of the suites feature full-sized kitchens stocked with cookware, separate living and sleeping areas and sofa beds. Some of the larger rooms have fireplaces and patios or balconies. Experience real country hospitality in the heart of bustling Nashville. The most vibrant<em> music scene </em>in the world is<em> just outside your front door.</em> |
503 |
| - Semantic Answer Score: 0.9860000014305115 |
| 500 | + 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. |
| 501 | + Semantic Answer Score: 0.9829999804496765 |
504 | 502 | ```
|
0 commit comments