Skip to content

feat(retail): add searchOffset, searchPagination, and searchRequest samples#4285

Open
angelcaamal wants to merge 4 commits intoGoogleCloudPlatform:mainfrom
angelcaamal:feat-retail-search-samples
Open

feat(retail): add searchOffset, searchPagination, and searchRequest samples#4285
angelcaamal wants to merge 4 commits intoGoogleCloudPlatform:mainfrom
angelcaamal:feat-retail-search-samples

Conversation

@angelcaamal
Copy link
Copy Markdown
Contributor

@angelcaamal angelcaamal commented Apr 14, 2026

Description

Fixes Internal: b/502273843
Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed guidelines from CONTRIBUTING.MD and Samples Style Guide
  • Tests pass: npm test (see Testing)
  • Lint pass: npm run lint (see Style)
  • Required CI tests pass (see CI testing)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This pull request is from a branch created directly off of GoogleCloudPlatform/nodejs-docs-samples. Not a fork.
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new sample directory, and I created GitHub Actions workflow for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

Note: Any check with (dev), (experimental), or (legacy) can be ignored and should not block your PR from merging (see CI testing).

…amples

This commit introduces new Node.js code samples for Vertex AI Search, including comprehensive Mocha tests and logic to handle root-level product IDs and async indexing.
@angelcaamal angelcaamal added the samples Issues that are directly related to samples. label Apr 14, 2026
@angelcaamal angelcaamal requested a review from a team as a code owner April 14, 2026 22:55
@angelcaamal angelcaamal added the api: vertex-ai Issues related to the Vertex AI API. label Apr 14, 2026
@angelcaamal angelcaamal requested review from a team as code owners April 14, 2026 22:55
@snippet-bot
Copy link
Copy Markdown

snippet-bot bot commented Apr 14, 2026

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added api: retail Issues related to the Retail API API. and removed api: vertex-ai Issues related to the Vertex AI API. labels Apr 14, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces Node.js snippets for Google Cloud Retail search features, including offset-based search, paginated search, and general search requests, along with a comprehensive test suite. The review feedback highlights opportunities to improve test robustness against existing data, ensure consistency across snippets by adding missing strict mode directives, and standardize logging and error handling patterns.

Comment thread retail/snippets/test/snippets.test.js Outdated
Comment thread retail/snippets/searchRequest.js
Comment thread retail/snippets/searchRequest.js Outdated
Comment thread retail/snippets/searchPagination.js Outdated
Standardized catch block messages and updated console.error to use comma-separated arguments with error.message || error for better visibility.
Introduced a 30-second delay after test product creation using timers/promises. This allows the Google Cloud Retail search indexes enough time to build, preventing flaky test failures caused by eventual consistency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: retail Issues related to the Retail API API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant