fix(core): canonicalize git_url before performing code search (#2612)

* fix(core): canonicalize git_url before performing code search

Previously, the git_url used in the index was not properly canonicalized, leading to inconsistencies when performing queries. This commit updates the code to ensure that the git_url is canonicalized before performing the code search.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Meng Zhang 2024-07-10 23:38:16 +09:00 committed by GitHub
parent 510a63c095
commit a3864a3280
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -0,0 +1,3 @@
kind: Fixed and Improvements
body: Canonicalize the git_url before performing a relevant code search. Previously, for git_urls with credentials, the canonicalized git_url was used in the index, but the query still used the raw git_url.
time: 2024-07-10T18:59:20.774068+09:00

View File

@ -84,7 +84,7 @@ impl CodeSearchImpl {
query.git_url, git_url
);
query.git_url = git_url.to_owned();
query.git_url = RepositoryConfig::canonicalize_url(git_url);
let docs_from_embedding = {
let embedding = self.embedding.embed(&query.content).await?;