feat: Add full-text page search to workspace (Closes #6)#11
feat: Add full-text page search to workspace (Closes #6)#11Votienduong2208 wants to merge 4 commits into
Conversation
- Update search filter in App.tsx to include page.textContent in matching - Update search placeholder in Toolbar to indicate text search capability - Update EmptyState description to mention text content search - Add integration test for text content extraction Closes YurMil#6
There was a problem hiding this comment.
Code Review
This pull request introduces text-content-based searching to the PDF master application, updating the page filtering logic, UI placeholders, and empty state descriptions, as well as adding an integration test for text extraction. However, several critical issues were identified: the textContent property is missing from the PageEntity and IngestPagePayload type definitions, which will cause TypeScript compilation errors, and the inspectPdfFile function does not yet extract or populate this field, causing the integration test to fail. Additionally, performing case-insensitive text matching inside the filter loop on every keystroke could lead to UI performance issues on larger documents, so caching or pre-lowercasing the text content is recommended.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Addressed the review feedback in commit 3c0482f.\n\nChanges:\n- added extContent to the ingest/page types and store hydration path\n- extracted per-page text during PDF inspection using pdfjs-dist\n- rebuilt the tracked static utility assets\n\nVerification:\n- corepack pnpm --dir apps/pdf-master test:run\n- corepack pnpm --dir apps/pdf-master build\n\nNote: the repo-level lint command still reports an unrelated pre-existing |
|
Pushed a follow-up commit to address the remaining search hot-path review note by caching lowercased page text per page instead of recomputing it on every search filter pass. Local verification after the update:
|
|
Addressed the review feedback in follow-up commits:\n\n- added extContent to the page payload/state types\n- extracted per-page text during PDF inspection and covered it with integration tests\n- cached lowercased page text for workspace search instead of lowercasing full page content inside the filter loop\n- refreshed the tracked static bundle under static/utilities/pdf-master\n\nVerification run locally:\n- pnpm.cmd test\n- pnpm.cmd build\n\nBoth passed in this environment (Node 24 with the repo's existing Node 22 engine warning). |
Summary
This PR implements full-text page search functionality for the PDF workspace. The text extraction was already implemented in the codebase during document ingestion ( and ), and the type already had the field. This PR connects the extracted text content to the search/filter functionality.
Changes
App.tsx: Updated the search logic to include in the matching criteria, allowing users to search for text keywords inside PDF pages.
Toolbar.tsx: Updated the search input placeholder from "Search pages" to "Search pages by text, label, or number" to indicate the new capability.
App.tsx: Updated the EmptyState description to mention text content search.
pdfInspection.integration.test.ts: Added a test case to verify text content extraction from PDF pages.
Technical Details
The search now matches against:
This is a simple substring match implementation. For larger workspaces, a more sophisticated search index (e.g., flexsearch) could be added in the future.
Closes #6