Add searched repo type to api/repo/search #972

Closed
opened 2025-11-02 03:43:50 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @Morlinest on GitHub (Aug 17, 2017).

Originally assigned to: @Morlinest on GitHub.

I want to add an option to look for a specific type of repo (fork, mirror, source, collaborative or all). I think there are two options how to search repositories:

  1. Search only 1 type - this means SearchRepoOptions will contain 1 attribute with one of possible values
  2. Search any combination of types at once - this means SearchRepoOptions will contains every possible option and result will be their mix (OR), for example mirror OR fork repositories

Any opinion? I've already done the first option, but second can be done very fast too.

Originally created by @Morlinest on GitHub (Aug 17, 2017). Originally assigned to: @Morlinest on GitHub. I want to add an option to look for a specific type of repo (`fork`,` mirror`, `source`,` collaborative` or `all`). I think there are two options how to search repositories: 1. Search only 1 type - this means `SearchRepoOptions` will contain 1 attribute with one of possible values 2. Search any combination of types at once - this means `SearchRepoOptions` will contains every possible option and result will be their mix (OR), for example `mirror` OR ` fork` repositories Any opinion? I've already done the first option, but second can be done very fast too.
GiteaMirror added the type/enhancement label 2025-11-02 03:43:50 -06:00
Author
Owner

@lunny commented on GitHub (Aug 17, 2017):

I think one is enough.

@lunny commented on GitHub (Aug 17, 2017): I think one is enough.
Author
Owner

@Morlinest commented on GitHub (Aug 17, 2017):

On first option I don't like the code (can be just bad because of my skills in GO and understanding this project code). I need new type RepoType, const for each type (like RepoTypeAll,RepoTypeFork, ...) and then 'map[string]RepoType' in handler to map query to this types. In second option, I can add each type directly to SearchRepoOptions as bools and use ifs in handler to set it. This is my "code" dilema :D

@Morlinest commented on GitHub (Aug 17, 2017): On first option I don't like the code (can be just bad because of my skills in GO and understanding this project code). I need new type `RepoType`, const for each type (like `RepoTypeAll`,`RepoTypeFork`, ...) and then 'map[string]RepoType' in handler to map query to this types. In second option, I can add each type directly to `SearchRepoOptions` as bools and use `if`s in handler to set it. This is my "code" dilema :D
Author
Owner

@lunny commented on GitHub (Aug 17, 2017):

I like first option.

@lunny commented on GitHub (Aug 17, 2017): I like first option.
Author
Owner

@Morlinest commented on GitHub (Aug 17, 2017):

@lunny OK :) Will send PR soon, you can assign this issue to me.

@Morlinest commented on GitHub (Aug 17, 2017): @lunny OK :) Will send PR soon, you can assign this issue to me.
Author
Owner

@Morlinest commented on GitHub (Nov 4, 2017):

Closed by #2756

@Morlinest commented on GitHub (Nov 4, 2017): Closed by #2756
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#972