Documentation
    Preparing search index...

    Source-document operations. Notify only: the watcher always retrieves content through the source callback.

    interface DocumentsApi {
        delete(
            request: { sources: string[] } | { filter: Record<string, unknown> },
        ): Promise<{ deleted: number }>;
        notify(
            documents: { rule: string; source: string }[],
            options?: NotifyOptions & { wait?: false },
        ): Promise<
            {
                accepted: string[];
                rejected: {
                    error: {
                        code: | "rule_missing"
                        | "invalid_reference"
                        | "unknown_source"
                        | "invalid_id"
                        | "queue_stopped";
                        message: string;
                    };
                    source: string;
                }[];
            },
        >;
        notify(
            documents: { rule: string; source: string }[],
            options: NotifyOptions & { wait: true },
        ): Promise<
            {
                results: {
                    chunks?: number;
                    error?: {
                        code: | "type_collision"
                        | "interpolation_error"
                        | "extraction_error"
                        | "embedding_error"
                        | "upsert_error"
                        | "match_failed"
                        | "rule_missing"
                        | "no_content"
                        | "source_unavailable"
                        | "unsupported_content_type"
                        | "invalid_reference"
                        | "unknown_source"
                        | "invalid_id"
                        | "queue_stopped";
                        details?: unknown;
                        message: string;
                    };
                    matched_rules?: string[];
                    source: string;
                    status: "indexed"
                    | "unchanged"
                    | "deleted"
                    | "failed";
                }[];
            },
        >;
        notify(
            documents: { rule: string; source: string }[],
            options?: NotifyOptions,
        ): Promise<
            | {
                accepted: string[];
                rejected: {
                    error: {
                        code: | "rule_missing"
                        | "invalid_reference"
                        | "unknown_source"
                        | "invalid_id"
                        | "queue_stopped";
                        message: string;
                    };
                    source: string;
                }[];
            }
            | {
                results: {
                    chunks?: number;
                    error?: {
                        code: | "type_collision"
                        | "interpolation_error"
                        | "extraction_error"
                        | "embedding_error"
                        | "upsert_error"
                        | "match_failed"
                        | "rule_missing"
                        | "no_content"
                        | "source_unavailable"
                        | "unsupported_content_type"
                        | "invalid_reference"
                        | "unknown_source"
                        | "invalid_id"
                        | "queue_stopped";
                        details?: unknown;
                        message: string;
                    };
                    matched_rules?: string[];
                    source: string;
                    status: "indexed"
                    | "unchanged"
                    | "deleted"
                    | "failed";
                }[];
            },
        >;
    }
    Index
    • Delete source documents (POST /documents/delete) by reference or by Qdrant filter. The server constrains the filter to points carrying source and no file_path, so file points are never deleted. A condition-free filter ({}, { must: [] }, f.and() with no operands, ...) would match every source document and is refused client-side with invalid_request before any request is sent.

      Parameters

      • request: { sources: string[] } | { filter: Record<string, unknown> }

        { sources } or { filter } (at least one condition).

        • { sources: string[] }
        • { filter: Record<string, unknown> }
          • filter: Record<string, unknown>

            Qdrant filter selecting the documents to delete (at least one condition).

      Returns Promise<{ deleted: number }>

      The number of documents (not points) removed.

    • Notify the watcher that source documents changed (POST /documents). The watcher queues and coalesces the references and retrieves each through its source callback. Resolves with the 202 body: accepted references and synchronously rejected notifications.

      Parameters

      • documents: { rule: string; source: string }[]

        1 to MAX_DOCUMENTS_PER_REQUEST { source, rule } notifications.

        • rule: string

          Name of the inference rule that indexes the document.

        • source: string

          Source reference (<name>://<id>).

      • Optionaloptions: NotifyOptions & { wait?: false }

        Omit, or { wait: false }.

      Returns Promise<
          {
              accepted: string[];
              rejected: {
                  error: {
                      code: | "rule_missing"
                      | "invalid_reference"
                      | "unknown_source"
                      | "invalid_id"
                      | "queue_stopped";
                      message: string;
                  };
                  source: string;
              }[];
          },
      >

    • Notify and process synchronously (POST /documents?wait=true). Resolves with one result per document (indexed, unchanged, deleted, failed).

      Parameters

      • documents: { rule: string; source: string }[]

        1 to MAX_DOCUMENTS_PER_REQUEST { source, rule } notifications.

        • rule: string

          Name of the inference rule that indexes the document.

        • source: string

          Source reference (<name>://<id>).

      • options: NotifyOptions & { wait: true }

        { wait: true }.

      Returns Promise<
          {
              results: {
                  chunks?: number;
                  error?: {
                      code: | "type_collision"
                      | "interpolation_error"
                      | "extraction_error"
                      | "embedding_error"
                      | "upsert_error"
                      | "match_failed"
                      | "rule_missing"
                      | "no_content"
                      | "source_unavailable"
                      | "unsupported_content_type"
                      | "invalid_reference"
                      | "unknown_source"
                      | "invalid_id"
                      | "queue_stopped";
                      details?: unknown;
                      message: string;
                  };
                  matched_rules?: string[];
                  source: string;
                  status: "indexed"
                  | "unchanged"
                  | "deleted"
                  | "failed";
              }[];
          },
      >

    • Notify with a wait flag known only at runtime.

      Parameters

      • documents: { rule: string; source: string }[]

        1 to MAX_DOCUMENTS_PER_REQUEST { source, rule } notifications.

        • rule: string

          Name of the inference rule that indexes the document.

        • source: string

          Source reference (<name>://<id>).

      • Optionaloptions: NotifyOptions

        Notify options.

      Returns Promise<
          | {
              accepted: string[];
              rejected: {
                  error: {
                      code: | "rule_missing"
                      | "invalid_reference"
                      | "unknown_source"
                      | "invalid_id"
                      | "queue_stopped";
                      message: string;
                  };
                  source: string;
              }[];
          }
          | {
              results: {
                  chunks?: number;
                  error?: {
                      code: | "type_collision"
                      | "interpolation_error"
                      | "extraction_error"
                      | "embedding_error"
                      | "upsert_error"
                      | "match_failed"
                      | "rule_missing"
                      | "no_content"
                      | "source_unavailable"
                      | "unsupported_content_type"
                      | "invalid_reference"
                      | "unknown_source"
                      | "invalid_id"
                      | "queue_stopped";
                      details?: unknown;
                      message: string;
                  };
                  matched_rules?: string[];
                  source: string;
                  status: "indexed"
                  | "unchanged"
                  | "deleted"
                  | "failed";
              }[];
          },
      >