Skip to content

Commit

Permalink
Revert "fix: an issue of keyword search feature in application log li…
Browse files Browse the repository at this point in the history
…st (#7816)"

This reverts commit ea748b5.
  • Loading branch information
takatost authored Sep 4, 2024
1 parent 71bff9f commit 2ac2f7b
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions api/controllers/console/app/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,21 @@ def get(self, app_model):

if args["keyword"]:
keyword_filter = "%{}%".format(args["keyword"])
message_subquery = (
db.session.query(Message.conversation_id)
.filter(or_(Message.query.ilike(keyword_filter), Message.answer.ilike(keyword_filter)))
.subquery()
)
query = query.join(subquery, subquery.c.conversation_id == Conversation.id).filter(
or_(
Conversation.id.in_(message_subquery),
Conversation.name.ilike(keyword_filter),
Conversation.introduction.ilike(keyword_filter),
subquery.c.from_end_user_session_id.ilike(keyword_filter),
),
query = (
query.join(
Message,
Message.conversation_id == Conversation.id,
)
.join(subquery, subquery.c.conversation_id == Conversation.id)
.filter(
or_(
Message.query.ilike(keyword_filter),
Message.answer.ilike(keyword_filter),
Conversation.name.ilike(keyword_filter),
Conversation.introduction.ilike(keyword_filter),
subquery.c.from_end_user_session_id.ilike(keyword_filter),
),
)
)

account = current_user
Expand Down

0 comments on commit 2ac2f7b

Please sign in to comment.