Exclude temp_* root folders from the CAD index
temp_paris, temp_davide, temp_studi esterni and the other temp_* folders are personal/scratch work areas on the share: they hold stale or unrelated copies of codes that also exist in the official project folders, and a real .asm can numerically coincide with an unrelated file living in one of these (see docs/formato-asm.md, the 2502020809 false-positive pulling in an unrelated machine's assembly from temp_studi esterni/Slitter CD549). Scan now deletes any already-indexed temp_* rows up front and skips walking those folders going forward, so downstream queries (Form1.cs, ExtractCreoStrings.cs) never need to filter them out case by case. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e7b5d85f6b
commit
c75dd21551
1 file changed
+17
-1
+17
-1
@@ -65,9 +65,25 @@ public static class Indexer
|
||||
schemaCmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
// Le cartelle "temp_*" (temp_paris, temp_davide, temp_studi esterni, ...) sono lavori
|
||||
// personali/temporanei: contengono spesso copie datate o versioni scollegate di codici
|
||||
// che esistono ANCHE nel resto della share, con lo stesso codice ma contenuto diverso.
|
||||
// Un .asm nella struttura "ufficiale" può referenziare per coincidenza numerica un file
|
||||
// dentro una di queste cartelle (vedi docs/formato-asm.md, falso positivo su
|
||||
// "2502020809"), trascinando dentro un intero assieme di un progetto scollegato. Vanno
|
||||
// escluse a monte, non solo filtrate caso per caso nelle singole query.
|
||||
using (var deleteTempCmd = connection.CreateCommand())
|
||||
{
|
||||
deleteTempCmd.CommandText = @"DELETE FROM files WHERE cartella_radice LIKE 'temp\_%' ESCAPE '\'";
|
||||
deleteTempCmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
// Indicizza tutte le cartelle di primo livello sotto la radice (non un elenco fisso),
|
||||
// così una nuova cartella creata sulla share entra nell'indice senza modificare il codice.
|
||||
var cartelleRadice = Directory.GetDirectories(root).Select(p => Path.GetFileName(p)!).ToArray();
|
||||
var cartelleRadice = Directory.GetDirectories(root)
|
||||
.Select(p => Path.GetFileName(p)!)
|
||||
.Where(c => !c.StartsWith("temp_", StringComparison.OrdinalIgnoreCase))
|
||||
.ToArray();
|
||||
|
||||
var previsti = new Dictionary<string, long>();
|
||||
foreach (var cartella in cartelleRadice)
|
||||
|
||||
Reference in new issue
Block a user