diff --git a/models/cloudbrain_image.go b/models/cloudbrain_image.go index c3d86da09..c88db0f67 100644 --- a/models/cloudbrain_image.go +++ b/models/cloudbrain_image.go @@ -352,7 +352,7 @@ func SearchImageCondition(opts *SearchImageOptions) builder.Cond { } subQuery := builder.Select("image_topic_relation.image_id").From("image_topic_relation"). - Join("INNER", "image_topic", "image_topic.id = image_topic_relation.image_id"). + Join("INNER", "image_topic", "image_topic.id = image_topic_relation.topic_id"). Where(subQueryCond). GroupBy("image_topic_relation.image_id") var keywordCond = builder.In("id", subQuery) @@ -375,7 +375,7 @@ func SearchImageCondition(opts *SearchImageOptions) builder.Cond { subQueryCond = subQueryCond.Or(builder.Eq{"LOWER(image_topic.name)": strings.ToLower(v)}) subQuery := builder.Select("image_topic_relation.image_id").From("image_topic_relation"). - Join("INNER", "image_topic", "image_topic.id = image_topic_relation.image_id"). + Join("INNER", "image_topic", "image_topic.id = image_topic_relation.topic_id"). Where(subQueryCond). GroupBy("image_topic_relation.image_id") var topicCond = builder.In("id", subQuery)