Topics cahanges

This commit is contained in:
Denis Zheleztsov 2018-01-05 17:39:37 +03:00
parent 0b6cc2e09d
commit a0728b97c8
2 changed files with 5 additions and 2 deletions

View File

@ -86,6 +86,7 @@ func (t topicid) findTopicID(msgid string, enter int) (string, error) {
if res.Hits.Hits[0].Source.TopicID != "" { if res.Hits.Hits[0].Source.TopicID != "" {
topicid = 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 == "" { 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 var t topicid
t.es = es t.es = es
topic := t.getOrCreate(&msg) topic := t.getOrCreate(&msg)
if msg.TopicID != topic { if msg.TopicID == "" {
msg.TopicID = topic msg.TopicID = topic
} }

View File

@ -123,7 +123,9 @@ func main() {
log.Debug("Check message ", m.ID) log.Debug("Check message ", m.ID)
_, err = elastic.CheckID(m.ID) _, err = elastic.CheckID(m.ID)
if err != nil && !reindex { if err != nil && !reindex {
log.Warn("New thread message " + m.ID) if reindex {
log.Warn("New thread message " + m.ID)
}
continue continue
} }
err = elastic.PutToIndex(esd) err = elastic.PutToIndex(esd)