|
@@ -139,7 +139,14 @@ func SearchDatasetCondition(opts *SearchDatasetOptions) builder.Cond { |
|
|
if opts.IncludePublic { |
|
|
if opts.IncludePublic { |
|
|
cond = cond.And(builder.Eq{"dataset.status": DatasetStatusPublic}) |
|
|
cond = cond.And(builder.Eq{"dataset.status": DatasetStatusPublic}) |
|
|
if opts.OwnerID > 0 { |
|
|
if opts.OwnerID > 0 { |
|
|
cond = cond.Or(builder.Eq{"repository.owner_id": opts.OwnerID}) |
|
|
|
|
|
|
|
|
if len(opts.Keyword) == 0 { |
|
|
|
|
|
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}) |
|
|
|
|
|
cond = cond.Or(subCon) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} else if opts.OwnerID > 0 { |
|
|
} else if opts.OwnerID > 0 { |
|
|
cond = cond.And(builder.Eq{"repository.owner_id": opts.OwnerID}) |
|
|
cond = cond.And(builder.Eq{"repository.owner_id": opts.OwnerID}) |
|
|