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)