|
|
@@ -32,7 +32,9 @@ func (e *EntryQueryBuilder) WithSearchQuery(query string) *EntryQueryBuilder {
|
|
|
nArgs := len(e.args) + 1
|
|
|
e.conditions = append(e.conditions, fmt.Sprintf("e.document_vectors @@ plainto_tsquery($%d)", nArgs))
|
|
|
e.args = append(e.args, query)
|
|
|
- e.WithOrder(fmt.Sprintf("ts_rank(document_vectors, plainto_tsquery($%d))", nArgs))
|
|
|
+
|
|
|
+ // 0.0000001 = 0.1 / (seconds_in_a_day)
|
|
|
+ e.WithOrder(fmt.Sprintf("ts_rank(document_vectors, plainto_tsquery($%d)) - extract (epoch from now() - published_at)::float * 0.0000001", nArgs))
|
|
|
e.WithDirection("DESC")
|
|
|
}
|
|
|
return e
|