Skip to content

feat: Add full-text page search to workspace (Closes #6)#11

Open
Votienduong2208 wants to merge 4 commits into
YurMil:mainfrom
Votienduong2208:feature/workspace-text-extraction-fulltext-search
Open

feat: Add full-text page search to workspace (Closes #6)#11
Votienduong2208 wants to merge 4 commits into
YurMil:mainfrom
Votienduong2208:feature/workspace-text-extraction-fulltext-search

Conversation

@Votienduong2208

Copy link
Copy Markdown
Contributor

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

  1. App.tsx: Updated the search logic to include in the matching criteria, allowing users to search for text keywords inside PDF pages.

  2. Toolbar.tsx: Updated the search input placeholder from "Search pages" to "Search pages by text, label, or number" to indicate the new capability.

  3. App.tsx: Updated the EmptyState description to mention text content search.

  4. pdfInspection.integration.test.ts: Added a test case to verify text content extraction from PDF pages.

Technical Details

The search now matches against:

  • Document names
  • Page labels
  • Page numbers (sourcePageIndex + 1)
  • Page text content (NEW) - extracted during document ingestion using pdfjs-dist's API

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

- 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

@gemini-code-assist gemini-code-assist Bot 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.

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.

Comment thread apps/pdf-master/src/services/pdfInspection.integration.test.ts
Comment thread apps/pdf-master/src/app/App.tsx Outdated
Comment thread apps/pdf-master/src/app/App.tsx Outdated
@Votienduong2208

Copy link
Copy Markdown
Contributor Author

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
eact-hooks/refs issue in src/components/PdfViewerDialog/PdfCanvasViewer.tsx.

@Votienduong2208

Copy link
Copy Markdown
Contributor Author

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:

  • corepack pnpm --dir apps/pdf-master run test:run pdfInspection.integration.test.ts
  • corepack pnpm --dir apps/pdf-master run build

@Votienduong2208

Copy link
Copy Markdown
Contributor Author

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).

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.

Feature: Workspace Text Extraction & Full-Text Page Search

1 participant