searchFor

tcmts.share.searchFor · #vdqt34rn · term · runs on the server

uses tcmts.share.shareNow, which uses process

What the finder finds for the header's search box: the first twenty, by name, doc or type.

import { HttpError } from "#codebase/tcmts/server";
import { searchResults, shareNow } from "#codebase/tcmts/share";

export async function searchFor(q: string) {
  const s = shareNow();
  if (!s.signedIn) throw new HttpError(401, "Sign in to search this server.");
  try {
    return searchResults(s, q).slice(0, 20);
  } catch {
    return [];
  }
}

uses

used by