Skip to content

Commit

Permalink
🔨 Fix: 임시로 첫 번째 문서의 벡터를 가져오는 코드 제거
Browse files Browse the repository at this point in the history
벡터가 없는 경우 오류 발생

#
  • Loading branch information
ks1ksi committed Jul 26, 2023
1 parent 9eb844e commit 07e7783
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/document/document.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,8 @@ export class DocumentService {
query: string,
vec: number[],
): Promise<DocumentDto[]> {
// vector는 unsupported data type이라서 string으로 변환해서 쿼리
// TODO: 첫 번째 문서의 vector 사용 대신 주어진 query로 vector 생성하도록 변경
const firstDocumentVector: any = await this.prisma.$queryRaw`
select uid, vector::text
from embedded_text
where uid = ${uid}
limit 1;
`;
const vector = toSql(vec);

const vector: string = firstDocumentVector[0].vector;
const items: any = await this.prisma.$queryRaw`
select document_id, min_distance
from ( select document_id, min(vector <-> ${vector}::vector) as min_distance
Expand Down

0 comments on commit 07e7783

Please sign in to comment.