From 487b50fcb43944801af734552eea2c00e624a390 Mon Sep 17 00:00:00 2001 From: Sarangan Rajamanickam Date: Thu, 21 Jan 2021 21:42:05 -0800 Subject: [PATCH] Update Test Code --- .../samples/typescript/src/indexes/analyzeText.ts | 5 ++--- .../samples/typescript/src/indexes/getIndex.ts | 8 ++------ .../samples/typescript/src/utils/setup.ts | 3 ++- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/sdk/search/search-documents/samples/typescript/src/indexes/analyzeText.ts b/sdk/search/search-documents/samples/typescript/src/indexes/analyzeText.ts index 037e8722e965..9dfcc481fb4c 100644 --- a/sdk/search/search-documents/samples/typescript/src/indexes/analyzeText.ts +++ b/sdk/search/search-documents/samples/typescript/src/indexes/analyzeText.ts @@ -22,7 +22,7 @@ export async function main() { return; } const client = new SearchIndexClient(endpoint, new AzureKeyCredential(apiKey)); - const index:SearchIndex = await client.getIndex("example-index"); + const index: SearchIndex = await client.getIndex("example-index"); index.tokenizers?.push({ name: "example-tokenizer", @@ -45,7 +45,7 @@ export async function main() { index.analyzers?.push({ name: "example-analyzer", odatatype: "#Microsoft.Azure.Search.CustomAnalyzer", - tokenizerName: "example-tokenizer", + tokenizer: "example-tokenizer", charFilters: ["example-char-filter"], tokenFilters: [KnownTokenFilterNames.Lowercase, "example-token-filter"] }); @@ -60,7 +60,6 @@ export async function main() { }); console.log(result.tokens); - } main().catch((err) => { diff --git a/sdk/search/search-documents/samples/typescript/src/indexes/getIndex.ts b/sdk/search/search-documents/samples/typescript/src/indexes/getIndex.ts index 0d3aefba1c90..3fca09179e67 100644 --- a/sdk/search/search-documents/samples/typescript/src/indexes/getIndex.ts +++ b/sdk/search/search-documents/samples/typescript/src/indexes/getIndex.ts @@ -1,11 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { - SearchIndexClient, - AzureKeyCredential, - SearchIndex -} from "@azure/search-documents"; +import { SearchIndexClient, AzureKeyCredential, SearchIndex } from "@azure/search-documents"; import * as dotenv from "dotenv"; dotenv.config(); @@ -20,7 +16,7 @@ export async function main() { } const client = new SearchIndexClient(endpoint, new AzureKeyCredential(apiKey)); console.log(`Get Index example-index`); - const index:SearchIndex = await client.getIndex("example-index"); + const index: SearchIndex = await client.getIndex("example-index"); console.log(`Name: ${index.name}`); console.log(`Similarity Algorithm: ${index.similarity?.odatatype}`); } diff --git a/sdk/search/search-documents/samples/typescript/src/utils/setup.ts b/sdk/search/search-documents/samples/typescript/src/utils/setup.ts index 07898f8702dd..b11da3d42934 100644 --- a/sdk/search/search-documents/samples/typescript/src/utils/setup.ts +++ b/sdk/search/search-documents/samples/typescript/src/utils/setup.ts @@ -189,7 +189,8 @@ export async function createIndex(client: SearchIndexClient, name: string): Prom suggesters: [ { name: "sg", - sourceFields: ["description", "hotelName"] + sourceFields: ["description", "hotelName"], + searchMode: "analyzingInfixMatching" } ], scoringProfiles: [