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

REST API for Code Search #31375

Open
kremerd opened this issue Jun 14, 2024 · 1 comment · May be fixed by #31515
Open

REST API for Code Search #31375

kremerd opened this issue Jun 14, 2024 · 1 comment · May be fixed by #31515
Labels
topic/api Concerns mainly the API type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@kremerd
Copy link

kremerd commented Jun 14, 2024

Feature Description

One of Giteas best features is the blazing fast indexed full text search available at /explore/code. Unfortunately it seems that there is no REST API to access this feature programmatically. Such an API would be very useful to visualize results or present them in some other way.

Therefore I propose to introduce a new REST API

GET /api/v1/version/code?q=<queryString>&t=<fuzzy>&page=<pageNumber>&limit=<pageSize>

It should return a list of search results, containing at least the matched repository, file path, line number und line content

[{
    "repository": "my-repository",
    "path": "src/test/resources/strings.properties",
    "lineNumber": 255,
    "line": "TEXT=Lorem ipsum solor delet"
}]

Screenshots

No response

@kremerd kremerd added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Jun 14, 2024
@lunny lunny added the modifies/api This PR adds API routes or modifies them label Jun 15, 2024
@kemzeb kemzeb added topic/api Concerns mainly the API and removed modifies/api This PR adds API routes or modifies them labels Jun 15, 2024
@knudtty knudtty linked a pull request Jun 28, 2024 that will close this issue
@knudtty
Copy link

knudtty commented Jun 28, 2024

I've put out a PR for this feature. It required refactoring the existing code search related modules in addition to adding new files for the api route. I decided to duplicate much of the web/explore/code.go function and adapt it for the API rather than a large refactor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/api Concerns mainly the API type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants