Recued
Menu
← Back to recipes

Search your documents

by recued-core v2 13 views

Use “Search your documents” in Recued. Search every PDF in a folder for a term and record which documents matched, with the page and the matching line. Each file is first checked as readable, so a document that could not be opened is reported as unreadable rather than counted as a miss.

Complete workflow

Document Search 4 pinned recipes

Use Document Search in Recued for PDF, retrieval, pdfgrep, and records. It includes 11 built-in actions and 3 ready-to-run workflows. Actions that change data use Recued's approval controls.

You are viewing one recipe in this workflow. Installing it opens the complete pack so its other recipes and background automations arrive together.

Search your documents
This recipe

Use “Search your documents” in Recued. Search every PDF in a folder for a term and record which documents matched, with the page and the matching line. Each file is first checked as readable, so a document that could not be opened is reported as unreadable rather than counted as a miss.

pack:document-searchsearchpdfdocuments
by recued-core pinned v2

Use “Show past document searches” in Recued. List search runs with their counts, including how many documents could not be opened. Read-only — it re-reads no file and re-runs no search.

pack:document-searchsearchboardrecords
by recued-core pinned v2

Use “Show what a search found” in Recued. List the documents one search run matched, with the page and the matching line, alongside the documents that could not be opened. Read-only.

pack:document-searchsearchboardrecords
by recued-core pinned v2
View pack details, dependencies, and permissions →

Why a match is read from the OUTPUT, not the exit status

⛔⛔ item.ok does NOT mean "matched". pdfgrep follows grep — a match exits 0, no match exits 1, an unreadable file exits 2 — and the pdfgrep pack declares exit_code_handling: { success_codes: [0, 1] }, so it deliberately treats no match as a SUCCESS. A step that found nothing therefore comes back ok: true with empty stdout. Keying matched on ok marks every readable document as a hit; that was a real defect here, caught only by driving the pack live against real PDFs.

So a match is excerpt is_not_empty, and readability is a separate pdfinfo probe (exit 0 readable, 1 corrupt — verified live). The two together give three outcomes:

pdfinfopdfgrep stdoutrecorded as
:--:--:--
oknon-emptymatched — with the page and line
okemptyno match — a real, trustworthy negative
non-zerounreadable — never counted as a miss

A search is only as trustworthy as its unreadable count. If that number is above zero, the answer "nothing mentions this" is not yet true — those files were never actually searched. The card reports it separately and the board shows it per run for exactly that reason.

How the search runs

The foreach is what makes this safe. A foreach step collects per-item failures as {ok:false} and still returns normally, so one unreadable file among two hundred cannot end the run. A non-foreach search step would have died on the first document that did not match.

Matching is case-insensitive and treats the term as a REGULAR EXPRESSION. pdfgrep -i is used, so renew finds Renewal; but . matches any character and ( will error. To search for a literal phrase with punctuation, this is not the recipe — the fixed-string operation exists in the pdfgrep pack but is not wired here.

Results are capped: at most Max files documents are searched per run, and pdfgrep itself stops at 50 matching lines per document. Anything beyond the cap is reported on the card as skipped, never silently dropped.

Only the matching line is stored, not the document. The excerpt is what pdfgrep printed — a page number and one line.

How it works 38 steps

Inspect the data fetches, transforms, gates, and output this recipe runs.

Process (38 steps)
term trim
Trim whitespace from setting term
folder trim
Trim whitespace from setting folder
inputs_valid all
Check if all conditions are true
inputs_guard guard
Stop if inputs valid equals
found ?
found_text default
Apply default
found_trimmed trim
Trim whitespace from found text
all_paths split
Split found trimmed into parts
files_found count
Count items in all paths
paths slice
Take a subset of
files_searched count
Count items in paths
files_skipped math
Calculate files found minus files searched
readable_probe ?
search_probe ?
readable_rows map
Extract from each item
search_rows map
Extract from each item
joined enrich_by
Apply enrich_by
unreadable_rows filter
Filter by condition
readable_only filter
Filter by condition
matched_rows filter
Filter by condition
missed_rows filter
Filter by condition
files_matched count
Count items in matched rows
files_unreadable count
Count items in unreadable rows
files_missed count
Count items in missed rows
trustworthy compare
Check if files unreadable equals 0
caveat ternary
Apply ternary
ran_at date_add
Add 0 seconds to
search_create ?
search_id default
Apply default
search_recorded compare
Check if search id has data
search_guard guard
Stop if search recorded equals
search_ref template
Generate text from a template
matched_with_ref map
Extract from each item
unreadable_with_ref map
Extract from each item
rows_to_record flatten
Flatten nested lists in
hit_create ?
recorded_count count
Count items in rows to record
card to_summary
Format results as a summary card
Settings 4 configurable

Configurable at install. Defaults shown — change them anytime in Recued.

term setting = [object Object]
folder setting = [object Object]
max depth setting = 1
max files setting = 50

About

Tags

pack:document-searchsearchpdfdocumentspdfgreprecordsv2

Details

38 steps 4 configurable settings recipe_id: search-documents