| @@ -126,25 +126,23 @@ func SearchDataset(opts *SearchDatasetOptions) (DatasetList, int64, error) { | |||||
| func SearchDatasetCondition(opts *SearchDatasetOptions) builder.Cond { | func SearchDatasetCondition(opts *SearchDatasetOptions) builder.Cond { | ||||
| var cond = builder.NewCond() | var cond = builder.NewCond() | ||||
| cond = cond.And(builder.Neq{"status": DatasetStatusDeleted}) | |||||
| cond = cond.And(builder.Neq{"dataset.status": DatasetStatusDeleted}) | |||||
| if len(opts.Keyword) > 0 { | if len(opts.Keyword) > 0 { | ||||
| cond = cond.And(builder.Like{"title", opts.Keyword}) | |||||
| cond = cond.And(builder.Like{"dataset.title", opts.Keyword}) | |||||
| } | } | ||||
| if opts.RepoID > 0 { | if opts.RepoID > 0 { | ||||
| cond = cond.And(builder.Eq{"repo_id": opts.RepoID}) | |||||
| cond = cond.And(builder.Eq{"dataset.repo_id": opts.RepoID}) | |||||
| } | } | ||||
| if opts.IncludePublic { | if opts.IncludePublic { | ||||
| cond = cond.And(builder.Eq{"status": DatasetStatusPublic}) | |||||
| cond = cond.And(builder.Eq{"dataset.status": DatasetStatusPublic}) | |||||
| if opts.OwnerID > 0 { | if opts.OwnerID > 0 { | ||||
| cond = cond.Or(builder.Eq{"user_id": opts.OwnerID}) | |||||
| } | |||||
| } else { | |||||
| if opts.OwnerID > 0 { | |||||
| cond = cond.And(builder.Eq{"user_id": opts.OwnerID}) | |||||
| cond = cond.Or(builder.Eq{"repository.owner_id": opts.OwnerID}) | |||||
| } | } | ||||
| } else if opts.OwnerID > 0 { | |||||
| cond = cond.And(builder.Eq{"repository.owner_id": opts.OwnerID}) | |||||
| } | } | ||||
| return cond | return cond | ||||
| @@ -161,12 +159,13 @@ func SearchDatasetByCondition(opts *SearchDatasetOptions, cond builder.Cond) (Da | |||||
| datasets := make(DatasetList, 0, opts.PageSize) | datasets := make(DatasetList, 0, opts.PageSize) | ||||
| count, err := sess.Where(cond).Count(new(Dataset)) | |||||
| count, err := sess.Join("INNER", "repository", "repository.id = dataset.repo_id").Where(cond).Count(new(Dataset)) | |||||
| if err != nil { | if err != nil { | ||||
| return nil, 0, fmt.Errorf("Count: %v", err) | return nil, 0, fmt.Errorf("Count: %v", err) | ||||
| } | } | ||||
| sess.Where(cond).OrderBy(opts.SearchOrderBy.String()) | |||||
| sess.Select("dataset.*").Join("INNER", "repository", "repository.id = dataset.repo_id").Where(cond).OrderBy(opts.SearchOrderBy.String()) | |||||
| if opts.PageSize > 0 { | if opts.PageSize > 0 { | ||||
| sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize) | sess.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize) | ||||
| } | } | ||||
| @@ -695,10 +695,10 @@ category.natural_language_processing= natural language processing | |||||
| category.speech_processing= speech processing | category.speech_processing= speech processing | ||||
| category.computer_vision_natural_language_processing= computer vision and natural language processing | category.computer_vision_natural_language_processing= computer vision and natural language processing | ||||
| attachment.delete= delete this version of dataset | attachment.delete= delete this version of dataset | ||||
| attachment.delete_desc= Are you sure you will delete this version of dataset, once deelted can not be recovery | |||||
| attachment.delete_desc= Are you sure you will delete this version of dataset, once deleted can not be recovery | |||||
| public= public | public= public | ||||
| private= private | private= private | ||||
| delete= deelte | |||||
| delete= delete | |||||
| [repo] | [repo] | ||||
| owner = Owner | owner = Owner | ||||
| @@ -229,7 +229,7 @@ func Profile(ctx *context.Context) { | |||||
| ctx.ServerError("SearchDatasets", err) | ctx.ServerError("SearchDatasets", err) | ||||
| } | } | ||||
| total = int(count) | total = int(count) | ||||
| ctx.Data["datasets"] = datasets | |||||
| ctx.Data["Datasets"] = datasets | |||||
| default: | default: | ||||
| repos, count, err = models.SearchRepository(&models.SearchRepoOptions{ | repos, count, err = models.SearchRepository(&models.SearchRepoOptions{ | ||||
| ListOptions: models.ListOptions{ | ListOptions: models.ListOptions{ | ||||
| @@ -607,8 +607,6 @@ github.com/spf13/jwalterweatherman | |||||
| github.com/spf13/pflag | github.com/spf13/pflag | ||||
| # github.com/spf13/viper v1.4.0 | # github.com/spf13/viper v1.4.0 | ||||
| github.com/spf13/viper | github.com/spf13/viper | ||||
| # github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518 | |||||
| ## explicit | |||||
| # github.com/steveyen/gtreap v0.1.0 | # github.com/steveyen/gtreap v0.1.0 | ||||
| github.com/steveyen/gtreap | github.com/steveyen/gtreap | ||||
| # github.com/stretchr/testify v1.4.0 | # github.com/stretchr/testify v1.4.0 | ||||
| @@ -640,8 +638,6 @@ github.com/toqueteos/webbrowser | |||||
| # github.com/tstranex/u2f v1.0.0 | # github.com/tstranex/u2f v1.0.0 | ||||
| ## explicit | ## explicit | ||||
| github.com/tstranex/u2f | github.com/tstranex/u2f | ||||
| # github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8 | |||||
| ## explicit | |||||
| # github.com/unknwon/cae v1.0.0 | # github.com/unknwon/cae v1.0.0 | ||||
| ## explicit | ## explicit | ||||
| github.com/unknwon/cae | github.com/unknwon/cae | ||||