Skip to content

Commit

Permalink
fix: search message sort and bug fix. (#412)
Browse files Browse the repository at this point in the history
* fix: search message sort and bug fix.

Signed-off-by: Gordon <[email protected]>

* fix: search message sort and bug fix.

Signed-off-by: Gordon <[email protected]>

---------

Signed-off-by: Gordon <[email protected]>
  • Loading branch information
FGadvancer authored Nov 17, 2023
1 parent 2c938ac commit e5e7716
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions internal/conversation_msg/conversation.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,16 +408,6 @@ func (c *Conversation) searchLocalMessages(ctx context.Context, searchParam *sdk
if c.filterMsg(&temp, searchParam) {
continue
}
if temp.ContentType == constant.File && !c.judgeMultipleSubString(searchParam.KeywordList, temp.FileElem.FileName, searchParam.KeywordListMatchType) {
continue
}
if temp.ContentType == constant.AtText && !c.judgeMultipleSubString(searchParam.KeywordList, temp.AtTextElem.Text, searchParam.KeywordListMatchType) {
continue
}
if temp.ContentType == constant.Text && !c.judgeMultipleSubString(searchParam.KeywordList, temp.TextElem.Content, searchParam.KeywordListMatchType) {
continue
}

switch temp.SessionType {
case constant.SingleChatType:
if temp.SendID == c.loginUserID {
Expand Down Expand Up @@ -465,6 +455,8 @@ func (c *Conversation) searchLocalMessages(ctx context.Context, searchParam *sdk
})
return &r, nil
}

// true is filter, false is not filter
func (c *Conversation) filterMsg(temp *sdk_struct.MsgStruct, searchParam *sdk.SearchLocalMessagesParams) bool {
switch temp.ContentType {
case constant.Text:
Expand All @@ -485,7 +477,6 @@ func (c *Conversation) filterMsg(temp *sdk_struct.MsgStruct, searchParam *sdk.Se
break
}
}

}
case constant.Card:
return !c.judgeMultipleSubString(searchParam.KeywordList, temp.CardElem.Nickname,
Expand All @@ -500,6 +491,8 @@ func (c *Conversation) filterMsg(temp *sdk_struct.MsgStruct, searchParam *sdk.Se
if !c.judgeMultipleSubString(searchParam.KeywordList, temp.QuoteElem.Text, searchParam.KeywordListMatchType) {
return c.filterMsg(temp.QuoteElem.QuoteMessage, searchParam)
}
default:
return true
}
return false
}
Expand Down

0 comments on commit e5e7716

Please sign in to comment.