pg-smart-search
API Reference

TypeScript Types

Core TypeScript interfaces and types used throughout the pg-smart-search SDK.

TypeScript Types

SearchResults

The return type of the engine.search() method.

export interface SearchResults<T = any> {
  data: T[];
  pagination: {
    nextCursor: string | null;
    hasMore: boolean;
  };
  metadata: {
    strategy: "fts" | "trigram" | "ilike" | "vector";
    latencyMs: number;
    cacheHit: boolean;
  };
}

HealthStatus

The return type of the engine.health() method.

export interface HealthStatus {
  db: "ok" | "error";
  cache: "ok" | "error";
  vectorProvider: "ok" | "error" | "disabled";
}

EngineMetrics

Real-time metrics exposed by the engine.

export interface EngineMetrics {
  cacheHitRate: number;
  dbLatency: number;
  providerErrors: number;
}