Loading...

Make them searchable

Files don't get searched directly — records do. Each record points at one file, and Search Stack reads the file's text out into the record for you. That's the whole trick of this lesson.

A record per file

Create a list — docs — and give it one record per file. The record carries a document field with the file's address, plus whatever else you'd like to show with a result: a title, the authors, a category. When a record lands, Search Stack opens the PDF and extracts its text automatically — there's nothing to configure and nothing to run. (Attach an embedding model too if you want search by meaning on top of the extracted text.)

Here's the finished example's list in the console — one record per paper, each pointing at its PDF:

The docs list in the console: one record per paper, each with a document_url pointing at the PDF, plus title, authors, category and year

Or from code

Loading the records is one request — the document field's address is all the setup extraction needs:

POST https://api.searchstack.dev/search-result/Demo/docs/with-fields
X-API-Key: {your key}
Content-Type: application/json

[
  {
    "name": "paper-attention",
    "title": "Attention Is All You Need",
    "authors": "Vaswani et al.",
    "document_url": "https://.../papers/paper-attention.pdf"
  }
]

Go deeper: Fields — resources, documents, and what gets searched in the reference.

Top