go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.5k stars 5.44k forks source link

Code search should look for the filename as well #32096

Open bsofiato opened 2 weeks ago

bsofiato commented 2 weeks ago

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

bsofiato commented 2 weeks ago

Cool guys, gonna work on this PR

bsofiato commented 1 week ago

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 ?

lunny commented 1 week ago

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.

bsofiato commented 1 week ago

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 1 week ago

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 ?

lunny commented 1 week ago

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.