chore(server): simplify search face query and better clustering (#5573)

* chore(server): simplify search face query and better clustering

* update sql

* Use correct syntax for utilizing the index

* Update sql
This commit is contained in:
Alex 2023-12-08 16:26:17 -06:00 committed by GitHub
parent 2234394aa6
commit f206cb9403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -88,7 +88,7 @@ export class SmartInfoRepository implements ISmartInfoRepository {
.select('1 + (faces.embedding <=> :embedding)', 'distance')
.innerJoin('faces.asset', 'asset')
.where('asset.ownerId = :ownerId')
.orderBy(`faces.embedding <=> :embedding`)
.orderBy('1 + (faces.embedding <=> :embedding)')
.setParameters({ ownerId, embedding: asVector(embedding) })
.limit(numResults);

View File

@ -98,7 +98,7 @@ WITH
WHERE
"asset"."ownerId" = $2
ORDER BY
"faces"."embedding" <= > $3 ASC
1 + ("faces"."embedding" <= > $3) ASC
LIMIT
100
)