mirror of
https://github.com/immich-app/immich.git
synced 2025-05-31 12:15:47 -04:00
fix new instance
This commit is contained in:
parent
e90f28985a
commit
217f6fe4fa
@ -188,17 +188,21 @@ export class DatabaseRepository {
|
|||||||
for (const indexName of names) {
|
for (const indexName of names) {
|
||||||
const row = rows.find((index) => index.indexname === indexName);
|
const row = rows.find((index) => index.indexname === indexName);
|
||||||
const table = VECTOR_INDEX_TABLES[indexName];
|
const table = VECTOR_INDEX_TABLES[indexName];
|
||||||
|
if (!row) {
|
||||||
|
promises.push(this.reindexVectors(indexName));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch (vectorExtension) {
|
switch (vectorExtension) {
|
||||||
case DatabaseExtension.VECTOR:
|
case DatabaseExtension.VECTOR:
|
||||||
case DatabaseExtension.VECTORS: {
|
case DatabaseExtension.VECTORS: {
|
||||||
if (!row?.indexdef.toLowerCase().includes(keyword)) {
|
if (!row.indexdef.toLowerCase().includes(keyword)) {
|
||||||
promises.push(this.reindexVectors(indexName));
|
promises.push(this.reindexVectors(indexName));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DatabaseExtension.VECTORCHORD: {
|
case DatabaseExtension.VECTORCHORD: {
|
||||||
const matches = row?.indexdef.match(/(?<=lists = \[)\d+/g);
|
const matches = row.indexdef.match(/(?<=lists = \[)\d+/g);
|
||||||
const lists = matches && matches.length > 0 ? Number(matches[0]) : 1;
|
const lists = matches && matches.length > 0 ? Number(matches[0]) : 1;
|
||||||
promises.push(
|
promises.push(
|
||||||
this.db
|
this.db
|
||||||
@ -209,7 +213,7 @@ export class DatabaseRepository {
|
|||||||
const targetLists = this.targetListCount(count);
|
const targetLists = this.targetListCount(count);
|
||||||
this.logger.log(`targetLists=${targetLists}, current=${lists} for ${indexName} of ${count} rows`);
|
this.logger.log(`targetLists=${targetLists}, current=${lists} for ${indexName} of ${count} rows`);
|
||||||
if (
|
if (
|
||||||
!row?.indexdef.toLowerCase().includes(keyword) ||
|
!row.indexdef.toLowerCase().includes(keyword) ||
|
||||||
// slack factor is to avoid frequent reindexing if the count is borderline
|
// slack factor is to avoid frequent reindexing if the count is borderline
|
||||||
(lists !== targetLists && lists !== this.targetListCount(count * VECTORCHORD_LIST_SLACK_FACTOR))
|
(lists !== targetLists && lists !== this.targetListCount(count * VECTORCHORD_LIST_SLACK_FACTOR))
|
||||||
) {
|
) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user