Code search should look for the filename as well #13515

Closed
opened 2025-11-02 10:44:51 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @bsofiato on GitHub (Sep 21, 2024).

Originally assigned to: @bsofiato on GitHub.

Feature Description

How do you guys feel about the code search feature taking the filenames into account?

Right now, Gitea only searches for the contents of the source files. I think the search should also look for the given criteria in the filenames (this is how Bitbucket and GitHub do it).

What do you guys think about it?

Screenshots

The screenshot below shows an excerpt of the GitHub docs that explains how the filename also searched

image

Originally created by @bsofiato on GitHub (Sep 21, 2024). Originally assigned to: @bsofiato on GitHub. ### Feature Description How do you guys feel about the code search feature taking the filenames into account? Right now, Gitea only searches for the contents of the source files. I think the search should also look for the given criteria in the filenames (this is how Bitbucket and GitHub do it). What do you guys think about it? ### Screenshots The screenshot below shows an excerpt of the [GitHub docs](https://docs.github.com/en/search-github/github-code-search/understanding-github-code-search-syntax) that explains how the filename also searched ![image](https://github.com/user-attachments/assets/fb25cca8-179a-4438-8c37-75cb374a6fd3)
GiteaMirror added the type/proposal label 2025-11-02 10:44:51 -06:00
Author
Owner

@bsofiato commented on GitHub (Sep 25, 2024):

Cool guys, gonna work on this PR

@bsofiato commented on GitHub (Sep 25, 2024): Cool guys, gonna work on this PR
Author
Owner

@bsofiato commented on GitHub (Sep 27, 2024):

Guys, a little question.

Do you think that, given a query, both bleve and elasticsearch should return the exact same results ? Or we can use a more lenient approach about which search backend returns ?

@bsofiato commented on GitHub (Sep 27, 2024): Guys, a little question. Do you think that, given a query, both bleve and elasticsearch should return the **exact** same results ? Or we can use a more lenient approach about which search backend returns ?
Author
Owner

@lunny commented on GitHub (Sep 28, 2024):

Guys, a little question.

Do you think that, given a query, both bleve and elasticsearch should return the exact same results ? Or we can use a more lenient approach about which search backend returns ?

I think we should input the same rule to these two engines, but we cannot control what they will output.

@lunny commented on GitHub (Sep 28, 2024): > Guys, a little question. > > Do you think that, given a query, both bleve and elasticsearch should return the **exact** same results ? Or we can use a more lenient approach about which search backend returns ? I think we should input the same rule to these two engines, but we cannot control what they will output.
Author
Owner

@bsofiato commented on GitHub (Oct 1, 2024):

Guys, just an update on this.

I'm still working on this one. Right now, I'm creating a compreensive test suite for the changes. It's gonna be a big PR :P

@bsofiato commented on GitHub (Oct 1, 2024): Guys, just an update on this. I'm still working on this one. Right now, I'm creating a compreensive test suite for the changes. It's gonna be a big PR :P
Author
Owner

@bsofiato commented on GitHub (Oct 2, 2024):

Guys, a little question.

I'm updating the unit test for the search funcionality. The test uses a fixture that sets the user2/repo1 repository up. May I change this particular repo to mirror some other tests cases or is it used elsewhere ?

@bsofiato commented on GitHub (Oct 2, 2024): Guys, a little question. I'm updating the unit test for the search funcionality. The test uses a fixture that sets the `user2/repo1` repository up. May I change this particular repo to mirror some other tests cases or is it used elsewhere ?
Author
Owner

@lunny commented on GitHub (Oct 3, 2024):

I suggest don't change a lot for this fixture repository because it's used everywhere. May be you can fork that repository and do some code search.

@lunny commented on GitHub (Oct 3, 2024): I suggest don't change a lot for this fixture repository because it's used everywhere. May be you can fork that repository and do some code search.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13515