
Back
Legal & Contract Analysis
A Purpose-Built Search Engine for 1.6 Million SEC & SEDAR Agreements
How Pfactorial Technologies built a clause-level search and question-answering engine over a corpus of 1.6 million SEC and SEDAR filings, purpose-built for transfer pricing, IP valuation and legal research.
August 21, 2026
Share
ENGAGEMENT SNAPSHOT

Figure 1 - Key figures from this engagement, at a glance.
EXECUTIVE SUMMARY
Our client, an information services firm supporting multinational corporations on intellectual property, transfer pricing and regulatory compliance research, needed to search company agreements filed with the SEC - quickly, precisely, and at a scale no manual review process could sustain.
Generic document search tools return whole documents, not the specific clause a researcher actually needs, and scanning full agreements for a transfer-pricing term or an IP valuation clause across a corpus of over a million filings simply doesn't scale.
Pfactorial built a purpose-built text-mining search engine over approximately 1.6 million SEC/SEDAR filings, combining OCR for image-based agreements, clause-level search that keeps keyword matches in the right legal context, smart document clustering, and a RAG-based question-answering layer for context-aware research.
Why this engagement is representative This engagement demonstrates Pfactorial building precision-focused search over an enormous legal and financial document corpus, where the value isn't finding a document - it's finding the specific clause, in the right context, at a scale that supports research work multinational corporations actually depend on.
THE CHALLENGE
Supporting real transfer pricing, IP valuation and legal research meant solving for precision and scale at once.
1. Keyword hits without clause context create false positives
A keyword appearing anywhere in a million-plus-document corpus is not the same as a keyword appearing in the relevant clause; without clause-level precision, researchers still have to manually verify every match.
2. A meaningful share of agreements are image-based
Some agreements are filed as scanned images rather than machine-readable text, and any search index built only from clean text would silently exclude them.
3. Research questions aren't always keyword-shaped
A researcher asking about a specific contract term or clause type needs an answer grounded in the actual filing text, not just a ranked list of documents to read themselves.
4. Scale demands infrastructure that stays fast, not just accurate
Searching and clustering across terabytes of legal and financial documents requires infrastructure that returns results in real time, not after a multi-minute batch query.
The real brief Not “index these filings for keyword search” but “build a search engine precise enough for transfer pricing and IP valuation research, at a scale of 1.6 million agreements.”
THE SOLUTION
Pfactorial built the engine around clause-level precision, OCR-recovered coverage, and a RAG-based answering layer, backed by infrastructure sized for terabytes of legal and financial documents.

Figure 2 - From 1.6 million raw filings to clause-level, context-aware answers.
Architectural principles
- Clause-level, not document-level, matching - Search results surface the specific clause a keyword appears in, reducing false positives compared to whole-document keyword matching.
- OCR coverage for image-based filings - OCR integration ensures agreements filed as scanned images are searchable alongside machine-readable text filings, rather than silently excluded.
- Clustering for context, not just ranking - Smart document clustering groups related agreements, supporting faster searches and deeper contextual insight beyond a flat ranked list.
- RAG for answers, not just retrieval - A retrieval-augmented question-answering layer provides context-aware answers grounded in the actual filing text, rather than requiring researchers to synthesize answers from raw search results themselves.
CAPABILITIES DELIVERED
Each capability targets a specific research need - precision, coverage, or synthesis - at corpus scale.
CAPABILITY | WHAT IT DOES |
|---|---|
Clause-level search | Keywords matched within the relevant clause, not just anywhere in the document. |
OCR-integrated coverage | Image-based agreements processed and made searchable alongside text filings. |
Smart document clustering | Related agreements grouped for faster search and deeper contextual insight. |
Query expansion & Boolean search | Real-time refinement for specific contract terms and legal research needs. |
RAG-based question answering | Context-aware answers grounded in the actual SEC filing text. |
Multi-select filtered interface | Intuitive navigation and structured results across a terabyte-scale document set. |

Figure 3 - Search capabilities built around clause-level precision, not document-level matching.
Design note Instead of scanning entire documents, users pinpoint keywords within relevant clauses - the entire architecture is built around that one precision requirement, since transfer pricing and IP valuation research live or die on whether the retrieved clause is actually the relevant one.
ENGINEERING FOR SCALE AND RELIABILITY
Six decisions carry the system through terabyte-scale legal and financial document search.
Multi-model classification pipeline
RoBERTa-based contract classification combined with NER models (spaCy, Transformers) for entity extraction gives the system structured understanding of each agreement, not just raw text.
OCR and PDF-processing coverage
Tesseract OCR and PDFPlumber ensure both scanned and digital agreements are processed into searchable text.
Vector-backed similarity search
Vector databases support semantic similarity search alongside traditional keyword indexing via Elasticsearch, enabling both exact and conceptual matching.
Custom regex for document classification
Custom regex filtering supplements model-based classification for structural document typing needs that benefit from deterministic rules.
Dual structured/document storage
PostgreSQL and MongoDB together handle structured metadata and flexible document storage respectively, matched to each data type's actual shape.
Cloud infrastructure sized for scale
AWS EC2 infrastructure supports the compute demands of processing and serving search across a corpus of this size.
DELIVERY APPROACH
The engagement built ingestion and classification first, then layered clustering, query refinement and RAG-based answering on top.
1. Document ingestion & OCR - Tesseract and PDFPlumber-based processing to bring both text and image-based filings into a searchable corpus.
2. Classification & entity extraction - RoBERTa-based contract classification and NER-based entity extraction across the corpus.
3. Indexing & similarity search - Elasticsearch and vector database integration for keyword and semantic search.
4. Clause-level search & clustering - the retrieval logic ensuring matches are contextually relevant, with document clustering for related-agreement discovery.
5. RAG question-answering layer - context-aware answer generation grounded in retrieved filing text.
6. Research interface - the multi-select filtered UI supporting intuitive navigation across structured search results.
RESULTS AND IMPACT

Figure 4 - Key outcomes from this engagement.
Contract analysts can locate agreements and specific clauses within approximately 1.6 million SEC/SEDAR filings quickly and precisely, replacing manual document-by-document review.
Improved accuracy and efficiency in agreement classification and data extraction translated directly into reduced manual effort and faster retrieval of critical financial and legal terms.
What it enabled commercially
The client can now support multinational corporate clients on IP valuation, transfer pricing and regulatory compliance research with a search infrastructure that finds the right clause in seconds, not the right document after minutes of manual reading - enhancing both research speed and regulatory compliance defensibility.
WHY PFACTORIAL
This engagement reflects Pfactorial's ability to build precision-focused search infrastructure at real corpus scale, where clause-level accuracy - not just fast retrieval - is what makes the system actually usable for the research questions it's built to answer.

Figure 5 - Service lines this engagement draws on.
Engagement enquiries Pfactorial Technologies works with information services and legal research firms that need precise, scalable search over large financial and legal document corpora. If you're evaluating a large-scale legal or financial document search initiative, we're happy to give you an honest read on scope and risk before anyone commits to anything. · pfactorial.ai
APPENDIX A - TECHNOLOGY STACK
The technology stack underpinning the system, grouped by the layer it serves.

© 2026 Pfactorial Technologies. Client identity and product-specific implementation detail are withheld or generalized; no client data, credentials, source code, or infrastructure detail is included in this document.
Result and Analysis
ENGAGEMENT SNAPSHOT
How Pfactorial Technologies built a clause-level search and question-answering engine over a corpus of 1.6 million SEC and SEDAR filings, purpose-built for transfer pricing, IP valuation and legal research.
CASE STUDIES
You might also like...

OCR & Document ExtractionRAG & Semantic Search
Aug 21, 20268 min readRead

OCR & Document Extraction
A Multi-Format Document Extraction Platform Built Around One OCR Contract
Aug 21, 20268 min readRead

Conversational AI & ChatbotsRAG & Semantic Search
A Retrieval-Augmented Chat Interface Over Structured Tax Records
Aug 21, 20267 min readRead

Conversational AI & ChatbotsRAG & Semantic SearchEnterprise Ops Platforms
An OCR and RAG Platform for Conversational Document Intelligence
Aug 21, 20268 min readRead

Legal & Contract Analysis
Architecting a Continuously Updated Legal Intelligence Platform
Aug 21, 20268 min readRead

RAG & Semantic SearchFinance & Payments
Architecting an AI-Native Financial Context Engine for Creators
Aug 21, 20269 min readRead





