diff --git a/db.go b/db.go index a218500..b14f7be 100644 --- a/db.go +++ b/db.go @@ -337,7 +337,7 @@ func SearchDocuments(query string, limit int) ([]Document, error) { FROM documents d JOIN documents_fts fts ON d.id = fts.id WHERE documents_fts MATCH ? - ORDER BY rank + ORDER BY d.processed_at DESC LIMIT ? `, query, limit) @@ -731,7 +731,7 @@ func SearchDocumentsWithFullText(query string, limit int) ([]Document, error) { FROM documents d JOIN documents_fts fts ON d.id = fts.id WHERE documents_fts MATCH ? - ORDER BY rank + ORDER BY d.processed_at DESC LIMIT ? `, query, limit) if err != nil { diff --git a/main.go b/main.go index 8c8a7d2..c432a10 100644 --- a/main.go +++ b/main.go @@ -157,6 +157,8 @@ func categoryIcon(cat string) string { func formatDate(s string) string { formats := []string{ + "2006-01-02T15:04:05-07:00", + "2006-01-02T15:04:05.999999-07:00", "2006-01-02T15:04:05.999999", "2006-01-02T15:04:05", "2006-01-02", diff --git a/templates/partials/document-list.html b/templates/partials/document-list.html index 526cb65..19ee29b 100644 --- a/templates/partials/document-list.html +++ b/templates/partials/document-list.html @@ -8,7 +8,10 @@

{{.Title}}

{{truncate .Summary 50}}

- {{title .Category}} +
+ {{title .Category}} + {{if .ProcessedAt}}{{formatDate .ProcessedAt}}{{end}} +
{{end}} diff --git a/templates/search.html b/templates/search.html index f0cec7b..dcdd732 100644 --- a/templates/search.html +++ b/templates/search.html @@ -56,7 +56,9 @@ {{title .Type}} {{end}} - {{if .Date}} + {{if .ProcessedAt}} + 📅 {{formatDateTime .ProcessedAt}} + {{else if .Date}} {{formatDate .Date}} {{end}} {{if .Score}}