Determine fuzziness of bleve indexer by keyword length (#29706)
also bleve did match on fuzzy search and the other way around. this also fix that bug. (cherry picked from commit b9c57fb78e8e0d80d786d8e1da433b6c7ebf2f1c) Conflicts: tests/integration/repo_search_test.go simple conflict resolution in the tests
This commit is contained in:
parent
b73117127c
commit
ab5f0b7558
4 changed files with 29 additions and 37 deletions
|
@ -46,7 +46,7 @@ func testSearchRepo(t *testing.T, useExternalIndexer bool) {
|
|||
|
||||
if useExternalIndexer {
|
||||
gitReference = "/commit/"
|
||||
executeIndexer(t, repo, code_indexer.UpdateRepoIndexer)
|
||||
code_indexer.UpdateRepoIndexer(repo)
|
||||
}
|
||||
|
||||
testSearch(t, "/user2/repo1/search?q=Description&page=1", gitReference, []string{"README.md"})
|
||||
|
@ -58,12 +58,14 @@ func testSearchRepo(t *testing.T, useExternalIndexer bool) {
|
|||
repo, err = repo_model.GetRepositoryByOwnerAndName(db.DefaultContext, "user2", "glob")
|
||||
assert.NoError(t, err)
|
||||
|
||||
executeIndexer(t, repo, code_indexer.UpdateRepoIndexer)
|
||||
code_indexer.UpdateRepoIndexer(repo)
|
||||
|
||||
testSearch(t, "/user2/glob/search?q=loren&page=1", gitReference, []string{"a.txt"})
|
||||
testSearch(t, "/user2/glob/search?q=file3&page=1", gitReference, []string{"x/b.txt"})
|
||||
testSearch(t, "/user2/glob/search?q=file4&page=1", gitReference, []string{})
|
||||
testSearch(t, "/user2/glob/search?q=file5&page=1", gitReference, []string{})
|
||||
testSearch(t, "/user2/glob/search?q=loren&page=1&t=match", gitReference, []string{"a.txt"})
|
||||
testSearch(t, "/user2/glob/search?q=file3&page=1", gitReference, []string{"x/b.txt", "a.txt"})
|
||||
testSearch(t, "/user2/glob/search?q=file3&page=1&t=match", gitReference, []string{"x/b.txt", "a.txt"})
|
||||
testSearch(t, "/user2/glob/search?q=file4&page=1&t=match", gitReference, []string{"x/b.txt", "a.txt"})
|
||||
testSearch(t, "/user2/glob/search?q=file5&page=1&t=match", gitReference, []string{"x/b.txt", "a.txt"})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +90,3 @@ func testSearch(t *testing.T, url, gitRef string, expected []string) {
|
|||
|
||||
checkResultLinks(t, gitRef, doc)
|
||||
}
|
||||
|
||||
func executeIndexer(t *testing.T, repo *repo_model.Repository, op func(*repo_model.Repository)) {
|
||||
op(repo)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue