mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-14 23:22:22 +00:00
feat: operation index (#5056)
* feat: operation index * fix: delete update vector * perf: Clear invalid data * perf: index * perf: cleare invalid data * index
This commit is contained in:
@@ -23,6 +23,12 @@ try {
|
||||
ImageSchema.index({ type: 1 });
|
||||
// delete related img
|
||||
ImageSchema.index({ teamId: 1, 'metadata.relatedId': 1 });
|
||||
|
||||
// Cron clear invalid img
|
||||
ImageSchema.index(
|
||||
{ createTime: 1 },
|
||||
{ partialFilterExpression: { 'metadata.relatedId': { $exists: true } } }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
@@ -132,6 +132,12 @@ try {
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Clear invalid image
|
||||
DatasetCollectionSchema.index({
|
||||
teamId: 1,
|
||||
'metadata.relatedImgId': 1
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
@@ -103,12 +103,14 @@ try {
|
||||
});
|
||||
// Recall vectors after data matching
|
||||
DatasetDataSchema.index({ teamId: 1, datasetId: 1, collectionId: 1, 'indexes.dataId': 1 });
|
||||
DatasetDataSchema.index({ updateTime: 1 });
|
||||
// rebuild data
|
||||
DatasetDataSchema.index({ rebuilding: 1, teamId: 1, datasetId: 1 });
|
||||
|
||||
// 为查询 initJieba 字段不存在的数据添加索引
|
||||
DatasetDataSchema.index({ initJieba: 1, updateTime: 1 });
|
||||
|
||||
// Cron clear invalid data
|
||||
DatasetDataSchema.index({ updateTime: 1 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ import {
|
||||
TeamMemberCollectionName
|
||||
} from '@fastgpt/global/support/user/team/constant';
|
||||
|
||||
export const OperationLogCollectionName = 'operationLog';
|
||||
export const OperationLogCollectionName = 'operationLogs';
|
||||
|
||||
const OperationLogSchema = new Schema({
|
||||
tmbId: {
|
||||
@@ -34,6 +34,9 @@ const OperationLogSchema = new Schema({
|
||||
}
|
||||
});
|
||||
|
||||
OperationLogSchema.index({ teamId: 1, tmbId: 1, event: 1 });
|
||||
OperationLogSchema.index({ timestamp: 1 }, { expireAfterSeconds: 14 * 24 * 60 * 60 }); // Auto delete after 14 days
|
||||
|
||||
export const MongoOperationLog = getMongoLogModel<OperationLogSchema>(
|
||||
OperationLogCollectionName,
|
||||
OperationLogSchema
|
||||
|
Reference in New Issue
Block a user