Skip to content

Bound and narrow product search results - #118

Draft
ldennington with Copilot wants to merge 1 commit into
mainfrom
copilot/task-11321782-1234088552-0c96f40b-f89f-451b-b971-aa8a29599803
Draft

ldennington with Copilot wants to merge 1 commit into
mainfrom
copilot/task-11321782-1234088552-0c96f40b-f89f-451b-b971-aa8a29599803

Conversation

Copilot AI commented Nov 9, 2026 •

Copy link
Copy Markdown

Product search returned every match with all product fields. This change caps results at 10 and selects only fields used by the dropdown.

  • Implemented

    take: 10,
    select: { id: true, name: true, price: true, image: true, category: true },
  • Other opportunities identified

    1. Add trigram indexes for product substring search.
    2. Index in-stock catalog listings by creation date.
    3. Paginate catalog and product-list results.
    4. Narrow homepage card fields.
    5. Revalidate the homepage catalog.
    6. Revalidate product detail pages.
    7. Narrow the products-list API response.
    8. Separate server-rendered product cards from cart interactions.
    9. Cancel or ignore stale search requests.

Co-authored-by: ldennington <11321782+ldennington@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 15:05
Copilot AI changed the title Improve product search response performance Bound and narrow product search results Nov 9, 2026
Copilot AI requested a review from ldennington November 9, 2026 15:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approved

No active review issues are recorded for the change to reduce product-search response size.

No open issues 🎉

What changed in this PR

This PR reduces the product-search API’s response size by limiting results and returning only fields used by the search dropdown.

Changes:

  • Caps search results at 10 while preserving newest-first ordering.
  • Selects only id, name, price, image, and category.
File Description
src/​app/​api/​products/​search/​route.ts Limits the query to 10 products and selects dropdown-required fields.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants