Delete 从 pgvector 表中删除指定文档。
(ctx context.Context, ids []string)
| 114 | |
| 115 | // Delete 从 pgvector 表中删除指定文档。 |
| 116 | func (s *Store) Delete(ctx context.Context, ids []string) error { |
| 117 | if len(ids) == 0 { |
| 118 | return nil |
| 119 | } |
| 120 | const tmpl = `DELETE FROM %s WHERE id = ANY($1);` |
| 121 | query := fmt.Sprintf(tmpl, s.table) |
| 122 | _, err := s.pool.Exec(ctx, query, ids) |
| 123 | return err |
| 124 | } |
| 125 | |
| 126 | // Query 在指定命名空间内执行向量检索。 |
| 127 | func (s *Store) Query(ctx context.Context, q vector.Query) ([]vector.Hit, error) { |