From 5737eac68213a31b54828873987845780f199f5a Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Tue, 8 Mar 2022 11:30:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E5=B9=BF=E5=9C=BA?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=94=AF=E6=8C=81=E6=90=9C=E7=B4=A2=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/dataset.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/dataset.go b/models/dataset.go index efc610630..096ab291c 100755 --- a/models/dataset.go +++ b/models/dataset.go @@ -118,7 +118,7 @@ func SearchDatasetCondition(opts *SearchDatasetOptions) builder.Cond { cond = cond.And(builder.Neq{"dataset.status": DatasetStatusDeleted}) if len(opts.Keyword) > 0 { - cond = cond.And(builder.Like{"dataset.title", opts.Keyword}) + cond = cond.And(builder.Or(builder.Like{"dataset.title", opts.Keyword}, builder.Like{"dataset.description", opts.Keyword})) } if len(opts.Category) > 0 { @@ -144,7 +144,7 @@ func SearchDatasetCondition(opts *SearchDatasetOptions) builder.Cond { cond = cond.Or(builder.Eq{"repository.owner_id": opts.OwnerID}) } else { subCon := builder.NewCond() - subCon = subCon.And(builder.Eq{"repository.owner_id": opts.OwnerID}, builder.Like{"dataset.title", opts.Keyword}) + subCon = subCon.And(builder.Eq{"repository.owner_id": opts.OwnerID}, builder.Or(builder.Like{"dataset.title", opts.Keyword}, builder.Like{"dataset.description", opts.Keyword})) cond = cond.Or(subCon) }