diff --git a/sdk/search/search-documents/README.md b/sdk/search/search-documents/README.md index 011e4dbe652b..c966cd048ca9 100644 --- a/sdk/search/search-documents/README.md +++ b/sdk/search/search-documents/README.md @@ -103,7 +103,7 @@ const client = new SearchClient( async function main() { // Let's get the top 5 jobs related to Microsoft - const searchResults = await client.search({ searchText: "Microsoft", top: 5 }); + const searchResults = await client.search("Microsoft", { top: 5 }); for await (const result of searchResults.results) { console.log(`${result.business_title}\n${result.job_description}\n`); } diff --git a/sdk/search/search-documents/samples/javascript/readonlyQuery.js b/sdk/search/search-documents/samples/javascript/readonlyQuery.js index f528f52bbd81..5923c691f85d 100644 --- a/sdk/search/search-documents/samples/javascript/readonlyQuery.js +++ b/sdk/search/search-documents/samples/javascript/readonlyQuery.js @@ -21,13 +21,14 @@ async function main() { const credential = new AzureKeyCredential(apiKey); const client = new SearchClient(endpoint, indexName, credential); - const count = await client.countDocuments(); + const count = await client.getDocumentsCount(); console.log(`${count} documents in index ${client.indexName}`); const state = "FL"; const country = "USA"; - const searchResults = await client.search({ - searchText: "WiFi", + const searchResults = await client.search( + "WiFi", + { filter: odata`Address/StateProvince eq ${state} and Address/Country eq ${country}`, orderBy: ["Rating desc"], select: ["HotelId", "HotelName", "Rating"] diff --git a/sdk/search/search-documents/samples/typescript/src/readonlyQuery.ts b/sdk/search/search-documents/samples/typescript/src/readonlyQuery.ts index 5b8b601c4267..9d362aa4a7df 100644 --- a/sdk/search/search-documents/samples/typescript/src/readonlyQuery.ts +++ b/sdk/search/search-documents/samples/typescript/src/readonlyQuery.ts @@ -51,13 +51,12 @@ export async function main() { const credential = new AzureKeyCredential(apiKey); const client = new SearchClient(endpoint, indexName, credential); - const count = await client.countDocuments(); + const count = await client.getDocumentsCount(); console.log(`${count} documents in index ${client.indexName}`); const state = "FL"; const country = "USA"; - const searchResults = await client.search({ - searchText: "WiFi", + const searchResults = await client.search("WiFi", { filter: odata`Address/StateProvince eq ${state} and Address/Country eq ${country}`, orderBy: ["Rating desc"], select: ["HotelId", "HotelName", "Rating"]