aboutsummaryrefslogtreecommitdiffhomepage
path: root/storage
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-07-04 22:05:19 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-07-04 22:05:19 -0700
commit6d0dc451e45effc8cbb6953a766b111036d893ce (patch)
tree3c7be86a036dfc77534fe89abb7d88413e5fdb52 /storage
parentaf15412954b9b36365f3fd723bf91b3c7c2f88bd (diff)
Add search form
Diffstat (limited to 'storage')
-rw-r--r--storage/entry_pagination_builder.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/storage/entry_pagination_builder.go b/storage/entry_pagination_builder.go
index 72fae8d..e443b00 100644
--- a/storage/entry_pagination_builder.go
+++ b/storage/entry_pagination_builder.go
@@ -23,6 +23,14 @@ type EntryPaginationBuilder struct {
direction string
}
+// WithSearchQuery adds full-text search query to the condition.
+func (e *EntryPaginationBuilder) WithSearchQuery(query string) {
+ if query != "" {
+ e.conditions = append(e.conditions, fmt.Sprintf("e.document_vectors @@ plainto_tsquery($%d)", len(e.args)+1))
+ e.args = append(e.args, query)
+ }
+}
+
// WithStarred adds starred to the condition.
func (e *EntryPaginationBuilder) WithStarred() {
e.conditions = append(e.conditions, "e.starred is true")