-
Suggestion
-
Resolution: Unresolved
-
None
-
None
-
None
-
14
-
Summary
A repository can not be searched for with the word that comes after a underscore, '_', from the repository search field. You can search for any other words in the repository name.
Environment
Bitbucket 4.12 or 5.2.2 with built in ElasticSearch.
Steps to Reproduce
- Create repository with the name first_second-third.
- Search for first or third in the repository search field to confirm the repository appears.
- Search for second in the repository search field.
Expected Results
A search for the the word "Second" would return the repository first_second-third.
Actual Results
first_second-third is not returned.
Here are the results from ElasticSearch directly:
curl -u bitbucket:<> -XPOST 'http://localhost:7992/bitbucket-search-v1/_search' -d '{"query":{"bool":{"should":[{"function_score":{"filter":{"term":{"quickSearchProjectName":"test"}},"field_value_factor":{"field":"quickSearchProjectName.length","modifier":"reciprocal"}}},{"function_score":{"filter":{"term":{"quickSearchRepositoryName":"first"}},"boost":5,"field_value_factor":{"field":"quickSearchRepositoryName.length","modifier":"reciprocal"}}}]}},"from":0,"size":9}' {"took":4,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.027238352,"hits":[{"_index":"bitbucket-search-v1","_type":"repository","_id":"155","_score":0.027238352,"_source":{"slug":"first_second-third","name":"first_second-third","quickSearchRepositoryName":"first_second-third","public":false,"fork":false,"quickSearchProjectName":"Underscore Test","projectId":124}}]}} curl -u bitbucket:<> -XPOST 'http://localhost:7992/bitbucket-search-v1/_search' -d '{"query":{"bool":{"should":[{"function_score":{"filter":{"term":{"quickSearchProjectName":"test"}},"field_value_factor":{"field":"quickSearchProjectName.length","modifier":"reciprocal"}}},{"function_score":{"filter":{"term":{"quickSearchRepositoryName":"second"}},"boost":5,"field_value_factor":{"field":"quickSearchRepositoryName.length","modifier":"reciprocal"}}}]}},"from":0,"size":9}' {"took":4,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}} curl -u bitbucket:<> -XPOST 'http://localhost:7992/bitbucket-search-v1/_search' -d '{"query":{"bool":{"should":[{"function_score":{"filter":{"term":{"quickSearchProjectName":"test"}},"field_value_factor":{"field":"quickSearchProjectName.length","modifier":"reciprocal"}}},{"function_score":{"filter":{"term":{"quickSearchRepositoryName":"third"}},"boost":5,"field_value_factor":{"field":"quickSearchRepositoryName.length","modifier":"reciprocal"}}}]}},"from":0,"size":9 {"took":4,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.027238352,"hits":[{"_index":"bitbucket-search-v1","_type":"repository","_id":"155","_score":0.027238352,"_source":{"slug":"first_second-third","name":"first_second-third","quickSearchRepositoryName":"first_second-third","public":false,"fork":false,"quickSearchProjectName":"Underscore Test","projectId":124}}]}}
Workaround
Rename the repository with another character