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

Search for text that includes underscore returns nothing #5277

Open
6 tasks
mfigrs opened this issue Nov 5, 2018 · 12 comments
Open
6 tasks

Search for text that includes underscore returns nothing #5277

mfigrs opened this issue Nov 5, 2018 · 12 comments
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug

Comments

@mfigrs
Copy link

mfigrs commented Nov 5, 2018

  • Gitea version (or commit ref): 6df46c5
  • Git version: 2.15.2
  • Operating system: Docker on Synology
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • [ x ] SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

I've enabled repository search in app.ini, however this feature is next to useless. If I search for a function name, say "list_users", the search returns nothing. Same for "list_" or "_users" - it seems as if the search doesn't like the underscore symbol.

@lunny
Copy link
Member

lunny commented Nov 5, 2018

It works here.

image

@mfigrs
Copy link
Author

mfigrs commented Nov 5, 2018

But here it does not:

2018-11-05

@lunny
Copy link
Member

lunny commented Nov 5, 2018

If you just enabled the feature on app.ini, it will spend some time to create the index, maybe the index is not finished.

@mfigrs
Copy link
Author

mfigrs commented Nov 5, 2018

I've enabled this feature over a week ago. Anyway, if I just enter "user" without any underscore, I have 3 pages of results:

2018-11-05 1

@zeripath
Copy link
Contributor

zeripath commented Nov 5, 2018

Hmm... I bet this has to do with the way bleve segments out words. Could it be that it's seeing and indexing "list_users" as "list users"?

@mfigrs
Copy link
Author

mfigrs commented Nov 5, 2018

Hmm... I bet this has to do with the way bleve segments out words. Could it be that it's seeing and indexing "list_users" as "list users"?

A search for "list users" also returns nothing, unfortunately...

Some other points:

  • search for "admin-users" text returns correct results
  • search for "admin-users.php" returns nothing, but it should return identical results to the above.

Furthermore:
Searching for ".users", "/users", "\users" seem to return the same results as plain search for "users"...

@zeripath
Copy link
Contributor

zeripath commented Nov 5, 2018

Hmm. OK a quick test of blevesearch/segment seems to imply that "list_users" would form a single segment.

@stale
Copy link

stale bot commented Jan 21, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Jan 21, 2019
@barryp
Copy link

barryp commented Jan 22, 2019

I just tried it with gitea 1.6.4 and it's still an issue. Single word queries give results, but snake_cased queries return nothing even though the variable names are present in the repo.

@stale stale bot removed the issue/stale label Jan 22, 2019
@lunny
Copy link
Member

lunny commented Jan 23, 2019

The words splitter just uses spaces to split the words. I think that's why when you have list_users but cannot search list or users. The current code search is very simple which need improvements.

@stale
Copy link

stale bot commented Mar 24, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Mar 24, 2019
@lunny lunny added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed issue/stale labels Mar 24, 2019
@bartwensley
Copy link

This issue renders the search functionality pretty much useless for code that regularly includes underscores (e.g. python). A couple more examples...

The following search returns a single result (there should be 33 matches from my count):
https://opendev.org/starlingx/config/search?q=_get_service_config

The following search returns no results (there should be 3 matches from my count):
https://opendev.org/starlingx/config/search?q=_get_admin_user_name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Projects
None yet
Development

No branches or pull requests

6 participants