Search by Document
Search your whole library by 'a page from this PDF'
- index
- model
- results
Every search node in this pack so far answers "find me something like this." Search by Document is the one that answers "find me everything like this page" - you hand it a PDF, pick a page, and it returns every indexed image, video, or other document page that looks like that page. It's how you turn one layout reference, one invoice, or one style sheet into a full "show me everything in this style" query.
The trick is that a PDF page becomes a picture before it becomes a vector. The pack renders the requested page (default 150 DPI, page_number is 1-indexed) and embeds the rendered image with your EMBEDDING_MODEL - same path as Search by Image. That means "similar to this page" means visually similar: same layout, same palette, same kind of content, same graphic style. It is not OCR, and it doesn't read the words. A page about the same topic typeset completely differently won't match; a visually identical layout with different text will.
Inputs
Required: index, model, pdf_path. Optional: page_number (default 1), top_k (default 50), min_score, result_type, instruction. Output: results (SEARCH_RESULTS).
Two setup facts worth knowing. First, PDF indexing (during Add Folder to Index, with include_documents on) requires pymupdf, another optional extra the pack lists but doesn't install by default - without it, documents never make it into the index in the first place:
pip install pymupdf
Second, the pack caps PDFs at 100 indexed pages per file, so the page you want as a query needs to be one that was actually indexed.
Install
The pack install itself is the same story - ComfyUI Manager (search "Semantic-Search") or git clone https://github.com/EricRollei/Semantic-Search into custom_nodes, then the base requirements. The pymupdf extra above is the only thing specific to working with documents.
Where people get burned
- "Document" results never appear. Missing pymupdf at indexing time is the classic cause - the PDFs were silently skipped. Install it, re-index the folder, and check the Add Folder status string for the
PDFs:count. - Expecting text matching. This node compares rendered pages as images. If you want "find the PDF about welding," a textual query is Search by Text's job; Search by Document is for "find everything laid out like this spec sheet."
- Page number confusion.
page_numberis 1-indexed, and the query page must be ≤ the indexed page count (capped at 100). Pointing at page 40 of a 20-page PDF just returns empty results - no error.
It's a niche node - you'll reach for it when you work with reference libraries, mood boards, or spec sheets and want "more like this" across mixed media. When you need it, nothing else in the pack does the job.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| index | SEMANTIC_INDEX | — | |
| model | EMBEDDING_MODEL | — | |
| pdf_path | STRING | — | |
| page_numberopt | INT | 11–1000 | Which page to use as the query (1-indexed) |
| top_kopt | INT | 501–500 | — |
| min_scoreopt | FLOAT | 0.000–1 | Minimum score threshold (0-1). Results below this score are filtered out. |
| result_typeopt | COMBO | all | Filter results by media type: all, images, videos, documents, or media (images+videos) |
| instructionopt | STRING | Custom instruction for the search (e.g., 'Find similar invoices') |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| results | SEARCH_RESULTS | — |