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

    Function createDiskAnnIndex

    • Helper to create DiskANN virtual table with proper SQL escaping

      Parameters

      • db: DatabaseLike

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

      • tableName: string

        Name for the virtual table

      • options: DiskAnnIndexOptions

        Index configuration

      Returns void

      // Basic index
      createDiskAnnIndex(db, "clip_embeddings", {
      dimension: 512,
      metric: "cosine",
      maxDegree: 64
      });

      // With metadata columns for filtered search
      createDiskAnnIndex(db, "photos", {
      dimension: 512,
      metric: "cosine",
      metadataColumns: [
      { name: 'category', type: 'TEXT' },
      { name: 'year', type: 'INTEGER' }
      ]
      });