From a0728b97c8b47fd85eb1a028be30ae5efa49565b Mon Sep 17 00:00:00 2001 From: Denis Zheleztsov Date: Fri, 5 Jan 2018 17:39:37 +0300 Subject: [PATCH] Topics cahanges --- i2es/elastic.go | 3 ++- main.go | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/i2es/elastic.go b/i2es/elastic.go index 1d29cc4..4353902 100644 --- a/i2es/elastic.go +++ b/i2es/elastic.go @@ -86,6 +86,7 @@ func (t topicid) findTopicID(msgid string, enter int) (string, error) { if res.Hits.Hits[0].Source.TopicID != "" { topicid = res.Hits.Hits[0].Source.TopicID + return topicid, nil } if res.Hits.Hits[0].Source.Repto != "" && res.Hits.Hits[0].Source.TopicID == "" { @@ -174,7 +175,7 @@ func (es ESConf) PutToIndex(msg ESDoc) error { var t topicid t.es = es topic := t.getOrCreate(&msg) - if msg.TopicID != topic { + if msg.TopicID == "" { msg.TopicID = topic } diff --git a/main.go b/main.go index a2a7bf3..1575566 100644 --- a/main.go +++ b/main.go @@ -123,7 +123,9 @@ func main() { log.Debug("Check message ", m.ID) _, err = elastic.CheckID(m.ID) if err != nil && !reindex { - log.Warn("New thread message " + m.ID) + if reindex { + log.Warn("New thread message " + m.ID) + } continue } err = elastic.PutToIndex(esd)