From c231d6ffb1648ad383ecb5d519aa858e3d126039 Mon Sep 17 00:00:00 2001 From: Vinicius de Andrade Date: Tue, 3 Oct 2023 11:54:43 -0300 Subject: [PATCH] =?UTF-8?q?[biblioref]=20Corre=C3=A7=C3=B5es=20menores?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bireme/biblioref/search_indexes.py | 10 ++++++++-- bireme/utils/views.py | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bireme/biblioref/search_indexes.py b/bireme/biblioref/search_indexes.py index 493c2326..743e4e7d 100644 --- a/bireme/biblioref/search_indexes.py +++ b/bireme/biblioref/search_indexes.py @@ -227,12 +227,18 @@ def prepare_related_research(self, obj): # add related research related_research_list = [] for related in related_research: - related_dict = {"_i": related.type.field, "_t": related.title, "_6": related.link, "_w": related.internal_id} + related_dict = {"_t": related.title, "_6": related.link, "_n": related.description} related_dict_json = self.dict2json(related_dict) related_research_list.append(related_dict_json) return related_research_list + def dict2json(self, raw_dict): + clean_dict = {k: v for k, v in raw_dict.items() if v} + json_out = json.dumps(clean_dict, ensure_ascii=False).encode('utf8') + + return json_out + def get_field_values(self, field, attribute = 'text'): field_values = [] try: @@ -472,7 +478,7 @@ def prepare_related_research(self, obj): # add related research related_research_list = [] for related in related_research: - related_dict = {"_i": related.type.field, "_t": related.title, "_6": related.link, "_w": related.internal_id} + related_dict = {"_t": related.title, "_6": related.link, "_n": related.description} related_dict_json = self.dict2json(related_dict) related_research_list.append(related_dict_json) diff --git a/bireme/utils/views.py b/bireme/utils/views.py index f8e48fd2..243ea09c 100644 --- a/bireme/utils/views.py +++ b/bireme/utils/views.py @@ -241,7 +241,6 @@ def decs_suggestion(request): text_by_lang[lang] = text_by_lang.get(lang, '') + ' ' + text['text'] service_url = settings.DECS_HIGHLIGHTER_URL - print(service_url) headers = { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',