mirror of
https://github.com/immich-app/immich.git
synced 2025-12-02 19:25:26 -05:00
19 lines
564 B
TypeScript
19 lines
564 B
TypeScript
import { AssetTable } from 'src/schema/tables/asset.table';
|
|
import { Column, ForeignKeyColumn, Index, Table } from 'src/sql-tools';
|
|
|
|
@Table({ name: 'smart_search' })
|
|
@Index({
|
|
name: 'clip_index',
|
|
using: 'hnsw',
|
|
expression: `embedding vector_cosine_ops`,
|
|
with: `ef_construction = 300, m = 16`,
|
|
synchronize: false,
|
|
})
|
|
export class SmartSearchTable {
|
|
@ForeignKeyColumn(() => AssetTable, { onDelete: 'CASCADE', primary: true })
|
|
assetId!: string;
|
|
|
|
@Column({ type: 'vector', length: 512, storage: 'external', synchronize: false })
|
|
embedding!: string;
|
|
}
|