Documents and AI

What happens to a document

Every file you add runs through the same background jobs on your server: its text is read, its type decided, its fields extracted and checked, its passages indexed. Its status in the Documents list shows where it is and whether it needs you.

ABOUT 10 MINUTESEXPLAINERFOR EVERYONEGETTING STARTED · STEP 4 OF 7

Logley principlePrivate by construction

Reading, classifying, extracting and indexing run as background jobs inside your Logley installation, with its own OCR engines, its own language model and its own search index.

The whole path at a glance

  1. It arrivesUploaded, dropped in a watched folder, or attached to mail in a connected mailbox.
  2. Its text is readFrom a PDF’s own text layer, or by OCR on your server when it is a scan.
  3. Its type is decidedOne of nine types; below that type’s threshold, a person is asked to confirm.
  4. Its fields are extractedParsers that read the page first, the local language model for the rest.
  5. It is checked and linkedValues against the page; supplier, shipment, duplicates and exchange rate.
  6. It is indexedPassages embedded into your private search index.
  7. Ready — or Needs reviewReady is in use at once. Needs review waits for a person, with the reason on the document.
Each step runs as a background job on your own server. The sections below take them one at a time.

How a document arrives

Four routes lead in, and the first three end in the same processing:

  • Upload. PDF, PNG, JPG, TIFF, XLSX, CSV and DOCX, up to 50 MB a file and 100 files a batch. Upload also takes a ZIP, which is unpacked so that each supported file inside becomes a document, and an EML, which is kept as correspondence while its attachments become documents. A type you choose for the batch is used as given.
  • A watched folder. Each new file is copied into Logley’s document storage and the original moved into a dated _processed folder inside the watched folder, so nothing is read twice. A ZIP or EML is unpacked as it is on Upload. A file of an unsupported type dropped in while Logley is watching goes to _rejected with a note saying why.
  • A connected mailbox. Attachments of the supported types become documents, keeping the sender and subject. The message body is not a document (only an .eml you upload is kept, as correspondence).
  • An ERP integration that pulls. Vendor bills arrive as finished invoice records with no file; none of the steps below apply to them.

An upload identical to a document already in your organization is refused, and the watched folder skips a file whose name and size match a document Logley already has. Uploading different content under an existing file name adds a new version of that document.

Getting the text

  • A PDF with its own text layer is read directly, with the position of every word — no OCR, and no OCR errors. A PDF whose text layer is missing or nearly empty is treated as a scan.
  • Scans and images are read by Tesseract, page by page, in your organization’s OCR Languages — English and Polish unless an administrator changes them.
  • When Tesseract is unsure (below 60% average confidence by default), PaddleOCR, a second engine running as its own local service, reads the pages too, and the better reading is kept. If that service cannot be reached, Tesseract’s reading is used and an alert warns that the result may be incomplete.
  • XLSX, CSV and DOCX are read as they are.

Settings, then Document intake, then Processing rules

The method used is shown under Document Information → OCR engine. The text is also scanned for email addresses, phone numbers, IBANs and tax IDs; a document containing any is marked Contains PII.

Deciding what it is

Every document is classified as one of nine types: Invoice, Receipt, CMR, Customs Declaration, Delivery Note, Transport Order, Contract, Correspondence or Other. A small, fast classifier (FastText), when installed, answers alone only when it is sure; keyword scoring does so only with a clear lead. Otherwise the local language model reads a sample of the text and is cross-checked against the keywords — and where the two disagree and the model is unsure, a person decides.

Each type has its own review threshold, and a classification below it goes to review as Classification needs confirmation: 70% for an invoice, 68% a customs declaration, 65% a CMR, 62% a receipt or transport order, 58% a delivery note, 55% a contract, 50% correspondence, 45% other. An administrator can change one with a server setting such as Classification:TypeThresholds:INVOICE:FlagReview.

Correspondence then gets a second look for an invoice, order or contract that arrived looking like a letter: if it is one, it is reclassified and flagged; if not, it is marked Skipped and gets no record. And a PDF of more than three pages that fits no type is searched for document boundaries, and split if it holds several documents.

Turning it into a record

With the type known, its fields are extracted — for an invoice, the number, the parties and their tax IDs, the dates, the amounts, the route and the line items. Parsers that read printed labels and page positions go first, the local language model reads what they could not, and every value is then checked against the text of the page. How a document becomes a record lists the fields and the order the readers run in; why a value is never a guess covers the checks.

Linking and checking

The record is then connected to what Logley already knows, and each connection doubles as a check:

  • An invoice is linked to a supplier whose tax ID or name matches; a half-hourly sweep creates a supplier once two unmatched invoices share a name.
  • Transport paperwork (CMRs, invoices, delivery notes, customs declarations, transport orders) is grouped into shipments.
  • A receipt is matched to the invoice it pays; a credit note is applied to the invoice it corrects.
  • An invoice or CMR resembling one already on file raises a possible-duplicate alert.
  • An invoice in another currency takes the rate for its issue date, or the nearest earlier one, from your own rate table; with none on file, its base-currency amount stays empty and flagged, never zero.
  • Rules triggered by Document read and Extraction complete run now — both after extraction, not on arrival.

Anything that needs a person (a type the classifier was unsure of, a value the page does not support, parties it cannot tell apart, a suspected duplicate) is flagged as it is found, and the document will end in Needs review.

Indexing, and when it becomes searchable

Last, the text is cut into passages of about 1,500 characters overlapping by 200, each within its page, and every passage is embedded by the local model nomic-embed-text into your private vector index. That is what lets Search find the document by meaning and Chat quote it with the page it came from. Its words are searchable a step earlier: file name, supplier, route, tags, notes and text enter the database’s full-text index as soon as they are stored.

Then the status settles. A document with nothing flagged becomes Ready; one with a flag stays Needs review and is indexed all the same — only an exact duplicate, or correspondence the second look could not settle, stops before indexing. An invoice that reaches Ready goes on to auto-approval. Rules triggered by Document processed (ready) run last, and webhook subscribers receive document.ready or document.needs_review, unless the document is private.

What each status means

These are the main statuses in the Documents list. The Status filter offers them in two groups: Processing, the stages a document passes through (Uploaded, Reading text, Extracting fields, Ready, Error, Skipped, Split), and Review, where a processed document waits for a decision (Needs review, Pending approval, On hold, Changes requested, Auto-approved, Approved, Rejected). Each option finds every document the list shows under that name, so Uploaded finds both Uploading… and Queued….

Statuses as the list shows them. Needs review rows carry the Needs you tag and an icon for each flag.
The badges in the Status column, in the order a document can meet them. A spinner means a worker still has the document.
Document statuses in the Documents list
StatusWhat it meansWhat to do
Uploading… or Queued…The file is stored and waiting for a background worker.Nothing.
Reading text…The text is being read from the file, or recognized by OCR.Nothing.
Extracting fields…The type is decided; fields are being extracted and the document indexed. It also shows during a re-extraction.Nothing.
ReadyProcessed with nothing flagged. It is searchable, can be quoted in answers, and its record is in use.Nothing.
Needs review, tagged Needs youProcessed, but something needs a person. The Needs attention panel on the document names each problem and how to fix it.Open it and follow How to fix.
Auto-approvedAn invoice that passed every auto-approval check. The checks it passed are written on its record.Nothing.
Pending approvalAn invoice held for approval. The checks it failed are listed on its record.Approve or reject it on the invoice record.
On holdAn invoice that does not match the order it bills. The reason is written on its record, and only a person with a reason gets it past the hold. Correcting the invoice or the order lifts it.Open the invoice record and resolve the mismatch.
Changes requestedAn approver sent the invoice back for a fix. It leaves their approval queue while it is corrected.Correct it; the approver can then approve or reject it.
Approved or RejectedA person decided on the invoice.Nothing.
SkippedConfirmed as correspondence. The file and its text are kept, but no record is extracted.If it is really an invoice, order or contract, reclassify it.
SplitA PDF that held several documents; each part is now a document of its own.Work with the parts, listed under Sub-documents.
ErrorProcessing stopped. An alert names the cause.See below.

When processing fails

A document that cannot be processed ends in Error, and an alert (Processing failed: and the file name) records why: a scan with no readable text, a file that cannot be opened, or the model or index service not running when it was needed. Fix the cause, then run it again:

  • No text could be read. Upload a clearer scan, or the PDF as it was generated. An identical file is refused as a duplicate; a new scan uploaded under the same name becomes the next version of the document.
  • A service was down, or a document is stuck in a busy state. Select it in the Documents list and use Re-process selected, up to 50 documents at a time. This starts again from the file: text, type, record and index.
  • The text is fine but the fields are wrong. Use Re-extract on the document instead; it runs extraction again on the stored text, with the current type.
Re-processing starts from nothing

Re-process selected decides the type again, even one you set by hand, and builds a new record. Corrections on the old record do not carry over; when the type comes out the same, the old record is deleted with its edit history. Re-process first, correct afterwards; when extraction gets something wrong sets out the order.

GETTING STARTED · NEXT STEP 5 OF 7Perform your first search
Continue

Continue exploring

Was this guide useful?

If something was missing or unclear, the contact page says where to write.

Contact