Back to Feed
article 2m read

Work wiki's API can't search page text, so the server reads every page

The task tool's documents API can't search full page content, so my server pulls one document, matches the phrase itself, and answers with excerpts and honest counts instead of page bodies.

Article DepthPractice

Flow

What one search answer tells me

  1. 1Hits

    Each matching page with a short excerpt. Never the whole page.

  2. 2Shown

    How many hits are in this answer, after the limit.

  3. 3Matched

    How many pages had the phrase, before the limit.

  4. 4Read

    How many pages the server pulled and checked. Zero hits out of many means more than zero out of a few.

  5. 5Errors

    Not found or upstream failure. Never an empty list standing in for a failure.

The task tool I use for work has a documents API that can list documents, show a page tree and hand back page text. It can't search inside pages. Its search doesn't look at full page content, and that's the part I need.

Search went into my own server

Every call I make to that tool goes through one small server behind my ops dashboard. The command line on my VM and the dashboard both use that server. So I put body search there, and both got it at once.

The change added four reads: list documents, list a document's pages, show one page, and search one document. All four only read. One surprise along the way: the documents part of the tool sits on a newer API version than the rest, so my request helper now picks a version per call.

One document at a time

A search names one document and a phrase. The server pulls every page of that document in one go, then keeps the pages whose title, subtitle or body contains the phrase, ignoring case. No index, no ranking. Asking for fewer results doesn't make it any cheaper, since the limit is applied after the scan.

Small answers with counts

A hit comes back with a short excerpt, never the whole page. If I want the page, I ask for it. Every answer also says three things:

  • how many hits it shows
  • how many pages matched
  • how many pages it read

Zero hits out of a few pages and zero out of hundreds are not the same answer. An unknown document says not found, and other errors say so too. An empty list only means the pages were read and the phrase wasn't there.

Where I'd still be careful

The document list stops after a set number of pages from the tool, and its total only counts what it got. A huge workspace would look complete when it isn't. Markdown might split a phrase with formatting, so plain text is the safer mode. And I haven't timed a search on a big document, so I don't know where it starts to drag.

Keep reading

Pick up a connected idea or branch into a nearby one.

5 paths forward