mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-05-09 14:08:19 +00:00
fix: exclude archived content from conversation search
Conversation search still surfaced hidden data after archiving because it only filtered out archived session rows. Active session rows that belonged to archived projects were still indexed, which broke the expectation that archived work disappears from normal search until it is restored. This change makes search follow the visible workspace model by skipping any session whose owning project is archived before ripgrep and transcript parsing begin. The archive-state lookup is cached per project path so the behavior is corrected without adding repeated database work during a scan.
This commit is contained in:
@@ -472,6 +472,7 @@ function extractGeminiText(content: unknown): string {
|
||||
|
||||
function normalizeSearchableSessions(rows: SessionRepositoryRow[]): SearchableSessionRow[] {
|
||||
const normalizedRows: SearchableSessionRow[] = [];
|
||||
const projectArchiveStateByPath = new Map<string, boolean>();
|
||||
|
||||
for (const row of rows) {
|
||||
const provider = row.provider as SearchableProvider;
|
||||
@@ -489,6 +490,27 @@ function normalizeSearchableSessions(rows: SessionRepositoryRow[]): SearchableSe
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Active session rows can still belong to an archived project because
|
||||
* project archiving intentionally preserves the underlying session data.
|
||||
* Global conversation search should follow the visible workspace model,
|
||||
* which means excluding any session whose owning project is archived.
|
||||
*
|
||||
* Cache the archive lookup per normalized project path so one search pass
|
||||
* does not re-query the same project row for every session in that folder.
|
||||
*/
|
||||
const normalizedProjectPath = typeof row.project_path === 'string' ? row.project_path.trim() : '';
|
||||
if (normalizedProjectPath) {
|
||||
if (!projectArchiveStateByPath.has(normalizedProjectPath)) {
|
||||
const projectRow = projectsDb.getProjectPath(normalizedProjectPath);
|
||||
projectArchiveStateByPath.set(normalizedProjectPath, Boolean(projectRow?.isArchived));
|
||||
}
|
||||
|
||||
if (projectArchiveStateByPath.get(normalizedProjectPath) === true) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
normalizedRows.push({
|
||||
...row,
|
||||
provider,
|
||||
|
||||
Reference in New Issue
Block a user