Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API route for explore/code search #31515

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

knudtty
Copy link

@knudtty knudtty commented Jun 28, 2024

Closes #31375

Creates an API endpoint at /explore/code to use the same code search from the web endpoint for /explore/code. This reuses as much code as possible from the web version without modifying behavior. New files have been added for the api route, return structs, and swagger.


Screenshot 2024-06-28 at 12 32 15 AM

Note for testing: You must set REPO_INDEXER_ENABLED = true in your app.ini config.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 28, 2024
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 28, 2024
@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code labels Jun 28, 2024
@knudtty knudtty force-pushed the code-search-api branch 2 times, most recently from f85c521 to 1232a01 Compare June 28, 2024 04:06
@knudtty knudtty marked this pull request as ready for review June 28, 2024 04:33
Copy link
Contributor

@kemzeb kemzeb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch! I have provided some general feedback.

routers/api/v1/explore/code.go Outdated Show resolved Hide resolved
routers/api/v1/explore/code.go Outdated Show resolved Hide resolved
routers/api/v1/explore/code.go Outdated Show resolved Hide resolved
modules/structs/explore.go Outdated Show resolved Hide resolved
routers/api/v1/explore/code.go Show resolved Hide resolved
modules/indexer/code/search.go Outdated Show resolved Hide resolved
modules/indexer/code/search.go Outdated Show resolved Hide resolved
routers/api/v1/explore/code.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 3, 2024
@kemzeb
Copy link
Contributor

kemzeb commented Jul 3, 2024

Whoops, did not mean to block this PR as my review is just general feedback. A maintainer with write access should be able to resolve this.

@kemzeb kemzeb self-requested a review July 3, 2024 02:53
@knudtty knudtty force-pushed the code-search-api branch 2 times, most recently from 853a39b to 3eab528 Compare July 10, 2024 03:30
@@ -890,6 +891,14 @@ func Routes() *web.Router {
// Misc (public accessible)
m.Group("", func() {
m.Get("/version", misc.Version)
m.Group("/explore", func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the API route be /search/code to align with the naming conventions of the GitHub API?

Suggested change
m.Group("/explore", func() {
m.Group("/search", func() {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

REST API for Code Search
4 participants