Skip to content

Return all matching pads from the search route - #90

Draft
JohnMcLear with Copilot wants to merge 6 commits into
mainfrom
copilot/optimize-search-performance
Draft

Return all matching pads from the search route#90
JohnMcLear with Copilot wants to merge 6 commits into
mainfrom
copilot/optimize-search-performance

Conversation

Copilot AI commented May 13, 2026

Copy link
Copy Markdown

The plugin’s search endpoint was only returning the last matching pad, even though it scans all pads. This change makes the route return the full set of matches and avoids scanning when the query is empty.

  • Search behavior

    • Replace the single-result object with an array of matching pad IDs.
    • Preserve case-insensitive matching across pad text.
    • Return JSON directly from the route.
  • Empty query handling

    • Short-circuit empty searches with [] instead of walking every pad.
  • Regression coverage

    • Add route-level coverage for:
      • multiple matching pads returned together
      • empty queries skipping the pad scan
const searchString = (req.query.query || '').toLowerCase();
const result = [];

if (!searchString) return res.json(result);

if (padText.toLowerCase().indexOf(searchString) !== -1) {
  result.push(pad);
}

res.json(result);

Copilot AI linked an issue May 13, 2026 that may be closed by this pull request
Copilot AI and others added 3 commits May 13, 2026 10:17
Agent-Logs-Url: https://github.com/ether/ep_search/sessions/8b580260-2991-4422-840d-5cb9f9b1e12d

Co-authored-by: JohnMcLear <220864+JohnMcLear@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ether/ep_search/sessions/8b580260-2991-4422-840d-5cb9f9b1e12d

Co-authored-by: JohnMcLear <220864+JohnMcLear@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ether/ep_search/sessions/8b580260-2991-4422-840d-5cb9f9b1e12d

Co-authored-by: JohnMcLear <220864+JohnMcLear@users.noreply.github.com>
Copilot AI changed the title [WIP] Optimize search functionality for better performance Return all matching pads from the search route May 13, 2026
Copilot AI requested a review from JohnMcLear May 13, 2026 10:20
JohnMcLear and others added 2 commits May 14, 2026 13:49
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

Search

2 participants