This commit is contained in:
2026-05-08 00:05:51 +08:00
parent 549b706fcc
commit ed70a140a2
40 changed files with 5590 additions and 36 deletions
@@ -7,6 +7,22 @@ use support\Db;
class ChunkSearchIndexRepository
{
public function resetEmbeddedChunksToPending(?string $archiveUid = null): int
{
$query = Db::table('chunks')
->where('embedding_status', EmbeddingStatus::EMBEDDED);
if ($archiveUid !== null && trim($archiveUid) !== '') {
$query->where('archive_uid', trim($archiveUid));
}
return $query->update([
'search_index_status' => SearchIndexStatus::PENDING,
'search_index_error' => null,
'search_index_updated_at' => null,
]);
}
public function queuePendingArchiveTasks(int $limit): array
{
$statuses = [
@@ -63,6 +79,7 @@ class ChunkSearchIndexRepository
'chunks.created_time',
'chunks.updated_time',
'archives.title',
'archives.summary',
'archives.source',
'archives.author',
'archives.year',
@@ -105,6 +122,7 @@ class ChunkSearchIndexRepository
'page_start' => $row->page_start === null ? null : (int) $row->page_start,
'page_end' => $row->page_end === null ? null : (int) $row->page_end,
'title' => $row->title,
'summary' => $row->summary,
'source' => $row->source,
'author' => $row->author,
'year' => $row->year === null ? null : (int) $row->year,