mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: add support for content search (#1728)
* Change MemoFind.ContentSearch to slice * Add support for content search * Change for go-simple sugguest --------- Co-authored-by: Athurg Feng <athurg@gooth.org>
This commit is contained in:
@@ -62,7 +62,7 @@ type FindMemoMessage struct {
|
||||
|
||||
// Domain specific fields
|
||||
Pinned *bool
|
||||
ContentSearch *string
|
||||
ContentSearch []string
|
||||
VisibilityList []Visibility
|
||||
|
||||
// Pagination
|
||||
@@ -233,8 +233,10 @@ func listMemos(ctx context.Context, tx *sql.Tx, find *FindMemoMessage) ([]*MemoM
|
||||
if v := find.Pinned; v != nil {
|
||||
where = append(where, "memo_organizer.pinned = 1")
|
||||
}
|
||||
if v := find.ContentSearch; v != nil {
|
||||
where, args = append(where, "memo.content LIKE ?"), append(args, "%"+*v+"%")
|
||||
if v := find.ContentSearch; len(v) != 0 {
|
||||
for _, s := range v {
|
||||
where, args = append(where, "memo.content LIKE ?"), append(args, "%"+s+"%")
|
||||
}
|
||||
}
|
||||
if v := find.VisibilityList; len(v) != 0 {
|
||||
list := []string{}
|
||||
|
Reference in New Issue
Block a user