Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(discoveryengine): update search sample to disable auto paginate #3500

Merged
merged 5 commits into from
Sep 20, 2023
Merged
Changes from 2 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
14 changes: 12 additions & 2 deletions discoveryengine/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,20 @@ async function main(
servingConfig: name,
};

const IResponseParams = {
ISearchResult: 0,
ISearchRequest: 1,
ISearchResponse: 2,
};
chenlei1216 marked this conversation as resolved.
Show resolved Hide resolved

// Perform search request
const response = await client.search(request);
const response = await client.search(request, {
// Should disable autoPaginate to avoid iterate through all pages.
autoPaginate: false,
});
const results = response[IResponseParams.ISearchResponse].results;

for (const result of response) {
for (const result of results) {
console.log(result);
}
}
Expand Down
Loading