Skip to content

Commit

Permalink
TLK-1987 Slack tool small improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneLightsOn committed Nov 1, 2024
1 parent 7dbd0c5 commit 9479120
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/backend/tools/slack/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def serialize_results(self, response):
document = self.extract_message_data(match)
results.append(document)
for match in response["files"]["matches"]:
document = self.extract_files_data(match)
document = self.extract_files_data(match, response["query"])
results.append(document)

return results
Expand All @@ -43,14 +43,14 @@ def extract_message_data(message_json):
return document

@staticmethod
def extract_files_data(message_json):
def extract_files_data(message_json, query=""):
document = {}
document["type"] = "file"
if "permalink" in message_json:
document["url"] = str(message_json.pop("permalink"))
if "title" in message_json:
document["title"] = str(message_json["title"])
document["text"] = str(message_json["title"])
document["text"] = f"{query} in {str(message_json['title'])}"

return document

Expand Down

0 comments on commit 9479120

Please sign in to comment.