From 8aebf57e9d3a52150047d88b9e5e6ce4c43f55f6 Mon Sep 17 00:00:00 2001 From: Lionel Walter Date: Sat, 7 Sep 2024 13:05:58 +0200 Subject: [PATCH] Fix linting --- README.md | 4 +--- api/app/elastic.py | 10 +++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 00a3d58..65351f1 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,4 @@ chmod g+rwx kibanadata sudo chgrp 0 esdata01 sudo chgrp 0 esdata02 sudo chgrp 0 kibanadata -``` - -Go to kibana : \ No newline at end of file +``` \ No newline at end of file diff --git a/api/app/elastic.py b/api/app/elastic.py index 0436ad8..567aa83 100644 --- a/api/app/elastic.py +++ b/api/app/elastic.py @@ -44,12 +44,8 @@ def search_documents(self, longitude: float, latitude: float, radius: str) -> li } } ], - "script_fields": { - "distance_in_m": { - "script": f"doc['coordinates'].arcDistance({latitude}, {longitude})" - } - }, - "_source": ["*"] + "script_fields": {"distance_in_m": {"script": f"doc['coordinates'].arcDistance({latitude}, {longitude})"}}, + "_source": ["*"], } ) hits = response["hits"]["hits"] @@ -57,7 +53,7 @@ def search_documents(self, longitude: float, latitude: float, radius: str) -> li source_fields = list(map(itemgetter("_source"), hits)) scripted_fields = list(map(itemgetter("fields"), hits)) - return list(map(lambda thing: {**thing.get("_source"), 'distance': thing.get("fields")["distance_in_m"][0]}, hits)) + return list(map(lambda thing: {**thing.get("_source"), "distance": thing.get("fields")["distance_in_m"][0]}, hits)) def search(self, query: dict) -> ObjectApiResponse: """Search for documents in the index, returning the elastic search response."""