Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/search/search-documents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ export async function main() {
const credential = new AzureKeyCredential(apiKey);
const client = new SearchClient<Hotel>(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"]
Expand Down