From 61d89ee58e6a4d990e6e81c951731c80c2cd1ece Mon Sep 17 00:00:00 2001 From: JP Appel Date: Thu, 12 Jun 2025 02:32:48 -0400 Subject: Minor bug fix --- pkg/data/put.go | 6 ++---- pkg/index/index.go | 5 +++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/data/put.go b/pkg/data/put.go index ac0dabc..a5237ae 100644 --- a/pkg/data/put.go +++ b/pkg/data/put.go @@ -131,11 +131,9 @@ func (p *PutMany) documents(ctx context.Context) error { // future inserts for _, doc := range p.pathDocs { title := sql.NullString{String: doc.Title, Valid: doc.Title != ""} - dateUnix := doc.Date.Unix() - date := sql.NullInt64{Int64: dateUnix, Valid: dateUnix != 0} + date := sql.NullInt64{Int64: doc.Date.Unix(), Valid: !doc.Date.IsZero()} - filetimeUnix := doc.FileTime.Unix() - filetime := sql.NullInt64{Int64: filetimeUnix, Valid: filetimeUnix != 0} + filetime := sql.NullInt64{Int64: doc.FileTime.Unix(), Valid: !doc.FileTime.IsZero()} meta := sql.NullString{String: doc.OtherMeta, Valid: doc.OtherMeta != ""} diff --git a/pkg/index/index.go b/pkg/index/index.go index 5d23e14..a96c227 100644 --- a/pkg/index/index.go +++ b/pkg/index/index.go @@ -120,9 +120,10 @@ func (doc *Document) parseDateNode(node ast.Node) error { return nil } - var err error - if doc.Date, err = util.ParseDateTime(dateStr); err != nil { + if date, err := util.ParseDateTime(dateStr); err != nil { return fmt.Errorf("Unable to parse date: %s", dateNode.Value) + } else { + doc.Date = date } return nil -- cgit v1.2.3