@photostructure/sqlite-diskann
    Preparing search index...

    Function insertVector

    • Insert a vector into a DiskANN index

      For indexes with metadata columns, use raw SQL instead to specify column names:

      Parameters

      • db: DatabaseLike

        Database instance (supports node:sqlite, better-sqlite3, @photostructure/sqlite)

      • tableName: string

        Name of the DiskANN virtual table

      • rowid: number

        Unique row identifier for this vector

      • vector: Float32Array<ArrayBufferLike> | number[]

        Vector as Float32Array or number[] (must match index dimension)

      Returns void

      // Basic insert (no metadata)
      const vec = new Float32Array([0.1, 0.2, 0.3]);
      insertVector(db, "embeddings", 1, vec);

      // With metadata - use raw SQL to specify column names
      db.prepare("INSERT INTO photos(rowid, vector, category, year) VALUES (?, ?, ?, ?)")
      .run(1, vec, 'landscape', 2024);