From 3063927b2ac688b6c4f55b971f3a084c1628ed2e Mon Sep 17 00:00:00 2001
From: Devin Gaffney <itsme@devingaffney.com>
Date: Tue, 29 Oct 2024 15:25:22 -0700
Subject: [PATCH] CV2-5050 remove some old logs from development work (#464)

* CV2-5050 remove some old logs from development work

* Update text_similarity.py
---
 app/main/lib/elastic_crud.py    | 1 -
 app/main/lib/media_crud.py      | 1 -
 app/main/lib/text_similarity.py | 5 ++---
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/app/main/lib/elastic_crud.py b/app/main/lib/elastic_crud.py
index 2c680afe..525e686f 100644
--- a/app/main/lib/elastic_crud.py
+++ b/app/main/lib/elastic_crud.py
@@ -52,7 +52,6 @@ def get_blocked_presto_response(task, model, modality):
     obj, temporary = get_object(task, model)
     doc_id = obj["doc_id"]
     callback_url = Presto.add_item_callback_url(app.config['ALEGRE_HOST'], modality)
-    app.logger.info(f"Object for {task} of model {model} with id of {doc_id} has requires_encoding value of {requires_encoding(obj)}")
     if requires_encoding(obj):
         blocked_results = []
         for model_key in obj.pop("models", []):
diff --git a/app/main/lib/media_crud.py b/app/main/lib/media_crud.py
index 3f409e46..74360ccb 100644
--- a/app/main/lib/media_crud.py
+++ b/app/main/lib/media_crud.py
@@ -144,7 +144,6 @@ def get_blocked_presto_response(task, model, modality):
     callback_url =  Presto.add_item_callback_url(app.config['ALEGRE_HOST'], modality)
     if task.get("doc_id") is None:
         task["doc_id"] = str(uuid.uuid4())
-    app.logger.error(f"Object for {task} of model {model} with id of {obj.id} has requires_encoding value of {obj.requires_encoding}")
     if obj.requires_encoding:
         response = get_presto_request_response(modality, callback_url, task)
         # Warning: this is a blocking hold to wait until we get a response in 
diff --git a/app/main/lib/text_similarity.py b/app/main/lib/text_similarity.py
index c484d843..aa7f78b4 100644
--- a/app/main/lib/text_similarity.py
+++ b/app/main/lib/text_similarity.py
@@ -109,7 +109,7 @@ def get_model_and_threshold(search_params):
   if 'per_model_threshold' in search_params and isinstance(search_params['per_model_threshold'], list) and [e for e in search_params['per_model_threshold'] if e["model"] == model_key]:
       threshold = [e for e in search_params['per_model_threshold'] if e["model"] == model_key][0]["value"]
   if threshold is None:
-      app.logger.error(
+      app.logger.warn(
           f"[Alegre Similarity] get_model_and_threshold - no threshold was specified, backing down to default of 0.9 - search_params is {search_params}")
       threshold = 0.9
   return model_key, threshold
@@ -193,8 +193,7 @@ def return_sources(results):
         May throw an error if source has index and score keys some day, but easy to fix for that,
         and should noisily break since it would have other downstream consequences.
     """
-    #TODO: remove underscore version after dependencies updated https://meedan.atlassian.net/browse/CV2-5546
-    return [dict(**r["_source"], **{"_id": r["_id"], "id": r["_id"], "index": r["_index"], "_score": r["_score"],"score": r["_score"]}) for r in results]
+    return [dict(**r["_source"], **{"_id": r["_id"], "id": r["_id"], "index": r["_index"], "score": r["_score"]}) for r in results]
 
 def strip_vectors(results):
     for result in results: