Skip to content

support search for literals for repository code search with indexer #33588

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

Closed
darren opened this issue Feb 14, 2025 · 2 comments · Fixed by #33590
Closed

support search for literals for repository code search with indexer #33588

darren opened this issue Feb 14, 2025 · 2 comments · Fixed by #33590
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@darren
Copy link
Contributor

darren commented Feb 14, 2025

Feature Description

Sometimes searching for SQL/function in code results in bad hits. eg: search swaggerParameterBodies in my local mirror of gitea:

Image

which is actually defined in

type swaggerParameterBodies struct {
not showing in the first page of the search result.

this is the indexer config

[indexer]
REPO_INDEXER_ENABLED = true
REPO_INDEXER_PATH = indexers/repos.bleve
# # 300k
MAX_FILE_SIZE = 307200
REPO_INDEXER_INCLUDE = 
REPO_INDEXER_EXCLUDE = go.sum,package-lock.json

Support searching for literals by enclosing search terms in double quotation marks would be better.

For bleve using Match Phrase Query

Screenshots

No response

@darren darren added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Feb 14, 2025
darren added a commit to darren/gitea that referenced this issue Feb 14, 2025
@darren
Copy link
Contributor Author

darren commented Feb 14, 2025

The case I tested above is swaggerParameterBodies, but I searched a local repo with a lot SQL queries and I am not quite satisfied with the search results thus I filed this issue.

As with the swaggerParameterBodies above I assume even using MatchQuery /routers/api/v1/swagger/options.go should come first, why?

@jpraet
Copy link
Member

jpraet commented Feb 14, 2025

More in general, I think your example screenshot above illustrates a problem I also notice on my instance after upgrading from 1.22 to 1.23.

Why is a search on "swaggerParameterBodies" returning results for "swagger"? Is that intended? Possible related to #32261?

Edit: not related to #32261, but instead to #32210: it changed the bleve query from NewMatchPhraseQuery to NewMatchQuery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants