From 2897afce41100a903f8f29409ea6d3de22e94ed3 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Fri, 11 Oct 2024 07:59:29 -0500 Subject: [PATCH] Reset saved search stats on reindex (#14280) --- frigate/embeddings/embeddings.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frigate/embeddings/embeddings.py b/frigate/embeddings/embeddings.py index 5fe0566f2..85c65b33e 100644 --- a/frigate/embeddings/embeddings.py +++ b/frigate/embeddings/embeddings.py @@ -3,6 +3,7 @@ import base64 import io import logging +import os import time from PIL import Image @@ -10,7 +11,11 @@ from playhouse.shortcuts import model_to_dict from frigate.comms.inter_process import InterProcessRequestor from frigate.config.semantic_search import SemanticSearchConfig -from frigate.const import UPDATE_EMBEDDINGS_REINDEX_PROGRESS, UPDATE_MODEL_STATE +from frigate.const import ( + CONFIG_DIR, + UPDATE_EMBEDDINGS_REINDEX_PROGRESS, + UPDATE_MODEL_STATE, +) from frigate.db.sqlitevecq import SqliteVecQueueDatabase from frigate.models import Event from frigate.types import ModelStatusTypesEnum @@ -160,6 +165,10 @@ class Embeddings: self.db.create_embeddings_tables() logger.debug("Created embeddings tables.") + # Delete the saved stats file + if os.path.exists(os.path.join(CONFIG_DIR, ".search_stats.json")): + os.remove(os.path.join(CONFIG_DIR, ".search_stats.json")) + st = time.time() totals = { "thumbnails": 0,