From 57e1e8e6bdbb2b8982bfec69113dfdef728b2b17 Mon Sep 17 00:00:00 2001 From: Stepan Vladovskiy Date: Fri, 21 Mar 2025 14:10:09 -0300 Subject: [PATCH] debug: more logs in indexing --- services/search.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/services/search.py b/services/search.py index 4f5f7105..78fb0daa 100644 --- a/services/search.py +++ b/services/search.py @@ -161,6 +161,19 @@ class SearchService: "/bulk-index", json={"documents": documents} ) + # Error Handling + if response.status_code == 422: + error_detail = response.json() + logger.error(f"Validation error from search service: {error_detail}") + + # Try to identify problematic documents + for doc in documents: + if len(doc['text']) > 10000: # Adjust threshold as needed + logger.warning(f"Document {doc['id']} has very long text: {len(doc['text'])} chars") + + # Continue with next batch instead of failing completely + continue + response.raise_for_status() result = response.json() logger.info(f"Batch {i//batch_size + 1} indexed successfully: {result}")