mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat: vectorchord (#18042)
* wip auto-detect available extensions auto-recovery, fix reindexing check use original image for ml * set probes * update image for sql checker update images for gha * cascade * fix new instance * accurate dummy vector * simplify dummy * preexisiting pg docs * handle different db name * maybe fix sql generation * revert refreshfaces sql change * redundant switch * outdated message * update docker compose files * Update docs/docs/administration/postgres-standalone.md Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> * tighten range * avoid always printing "vector reindexing complete" * remove nesting * use new images * add vchord to unit tests * debug e2e image * mention 1.107.2 in startup error * support new vchord versions --------- Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com>
This commit is contained in:
parent
fe71894308
commit
0d773af6c3
35 changed files with 572 additions and 444 deletions
|
|
@ -11,11 +11,3 @@ WHERE
|
|||
|
||||
-- DatabaseRepository.getPostgresVersion
|
||||
SHOW server_version
|
||||
|
||||
-- DatabaseRepository.shouldReindex
|
||||
SELECT
|
||||
idx_status
|
||||
FROM
|
||||
pg_vector_index_stat
|
||||
WHERE
|
||||
indexname = $1
|
||||
|
|
|
|||
|
|
@ -204,6 +204,21 @@ where
|
|||
"person"."ownerId" = $3
|
||||
and "asset_faces"."deletedAt" is null
|
||||
|
||||
-- PersonRepository.refreshFaces
|
||||
with
|
||||
"added_embeddings" as (
|
||||
insert into
|
||||
"face_search" ("faceId", "embedding")
|
||||
values
|
||||
($1, $2)
|
||||
)
|
||||
select
|
||||
from
|
||||
(
|
||||
select
|
||||
1
|
||||
) as "dummy"
|
||||
|
||||
-- PersonRepository.getFacesByIds
|
||||
select
|
||||
"asset_faces".*,
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ limit
|
|||
$15
|
||||
|
||||
-- SearchRepository.searchSmart
|
||||
begin
|
||||
set
|
||||
local vchordrq.probes = 1
|
||||
select
|
||||
"assets".*
|
||||
from
|
||||
|
|
@ -83,8 +86,12 @@ limit
|
|||
$7
|
||||
offset
|
||||
$8
|
||||
commit
|
||||
|
||||
-- SearchRepository.searchDuplicates
|
||||
begin
|
||||
set
|
||||
local vchordrq.probes = 1
|
||||
with
|
||||
"cte" as (
|
||||
select
|
||||
|
|
@ -102,18 +109,22 @@ with
|
|||
and "assets"."id" != $5::uuid
|
||||
and "assets"."stackId" is null
|
||||
order by
|
||||
smart_search.embedding <=> $6
|
||||
"distance"
|
||||
limit
|
||||
$7
|
||||
$6
|
||||
)
|
||||
select
|
||||
*
|
||||
from
|
||||
"cte"
|
||||
where
|
||||
"cte"."distance" <= $8
|
||||
"cte"."distance" <= $7
|
||||
commit
|
||||
|
||||
-- SearchRepository.searchFaces
|
||||
begin
|
||||
set
|
||||
local vchordrq.probes = 1
|
||||
with
|
||||
"cte" as (
|
||||
select
|
||||
|
|
@ -129,16 +140,17 @@ with
|
|||
"assets"."ownerId" = any ($2::uuid[])
|
||||
and "assets"."deletedAt" is null
|
||||
order by
|
||||
face_search.embedding <=> $3
|
||||
"distance"
|
||||
limit
|
||||
$4
|
||||
$3
|
||||
)
|
||||
select
|
||||
*
|
||||
from
|
||||
"cte"
|
||||
where
|
||||
"cte"."distance" <= $5
|
||||
"cte"."distance" <= $4
|
||||
commit
|
||||
|
||||
-- SearchRepository.searchPlaces
|
||||
select
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue