mirror of
https://github.com/go-shiori/shiori.git
synced 2024-09-20 15:06:14 +08:00
fix err in keyword searching (#494)
This commit is contained in:
parent
d15dc18674
commit
821b69d76c
|
@ -223,7 +223,9 @@ func (db *PGDatabase) GetBookmarks(ctx context.Context, opts GetBookmarksOptions
|
|||
if opts.Keyword != "" {
|
||||
query += ` AND (
|
||||
url LIKE :lkw OR
|
||||
MATCH(title, excerpt, content) AGAINST (:kw IN BOOLEAN MODE)
|
||||
title LIKE :kw OR
|
||||
excerpt LIKE :kw OR
|
||||
content LIKE :kw
|
||||
)`
|
||||
|
||||
arg["lkw"] = "%" + opts.Keyword + "%"
|
||||
|
@ -356,7 +358,9 @@ func (db *PGDatabase) GetBookmarksCount(ctx context.Context, opts GetBookmarksOp
|
|||
if opts.Keyword != "" {
|
||||
query += ` AND (
|
||||
url LIKE :lurl OR
|
||||
MATCH(title, excerpt, content) AGAINST (:kw IN BOOLEAN MODE)
|
||||
title LIKE :kw OR
|
||||
excerpt LIKE :kw OR
|
||||
content LIKE :kw
|
||||
)`
|
||||
|
||||
arg["lurl"] = "%" + opts.Keyword + "%"
|
||||
|
|
|
@ -355,6 +355,10 @@ func (db *SQLiteDatabase) GetBookmarks(ctx context.Context, opts GetBookmarksOpt
|
|||
bookmarkIds = append(bookmarkIds, book.ID)
|
||||
}
|
||||
|
||||
if len(bookmarkIds) == 0 {
|
||||
return bookmarks, nil
|
||||
}
|
||||
|
||||
// If content needed, fetch it separately
|
||||
// It's faster than join with virtual table
|
||||
if opts.WithContent {
|
||||
|
|
Loading…
Reference in a new issue