mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 22:43:32 +00:00
feat: set fuzzy as default for issue search (#5270)
Closes #5225 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5270 Reviewed-by: Otto <otto@codeberg.org> Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com> Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
This commit is contained in:
parent
630595a7f3
commit
6178a46fe2
|
@ -203,7 +203,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption opt
|
||||||
keyword = ""
|
keyword = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
isFuzzy := ctx.FormBool("fuzzy")
|
isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
|
||||||
|
|
||||||
var mileIDs []int64
|
var mileIDs []int64
|
||||||
if milestoneID > 0 || milestoneID == db.NoConditionID { // -1 to get those issues which have no any milestone assigned
|
if milestoneID > 0 || milestoneID == db.NoConditionID { // -1 to get those issues which have no any milestone assigned
|
||||||
|
|
|
@ -448,7 +448,7 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
|
||||||
User: ctx.Doer,
|
User: ctx.Doer,
|
||||||
}
|
}
|
||||||
|
|
||||||
isFuzzy := ctx.FormBool("fuzzy")
|
isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true)
|
||||||
|
|
||||||
// Search all repositories which
|
// Search all repositories which
|
||||||
//
|
//
|
||||||
|
|
|
@ -146,7 +146,8 @@ func TestViewIssuesKeyword(t *testing.T) {
|
||||||
assert.EqualValues(t, 0, issuesSelection.Length())
|
assert.EqualValues(t, 0, issuesSelection.Length())
|
||||||
|
|
||||||
// should match as 'first' when fuzzy seaeching is enabled
|
// should match as 'first' when fuzzy seaeching is enabled
|
||||||
req = NewRequestf(t, "GET", "%s/issues?q=%st&fuzzy=true", repo.Link(), keyword)
|
for _, fmt := range []string{"%s/issues?q=%st&fuzzy=true", "%s/issues?q=%st"} {
|
||||||
|
req = NewRequestf(t, "GET", fmt, repo.Link(), keyword)
|
||||||
resp = MakeRequest(t, req, http.StatusOK)
|
resp = MakeRequest(t, req, http.StatusOK)
|
||||||
htmlDoc = NewHTMLParser(t, resp.Body)
|
htmlDoc = NewHTMLParser(t, resp.Body)
|
||||||
issuesSelection = getIssuesSelection(t, htmlDoc)
|
issuesSelection = getIssuesSelection(t, htmlDoc)
|
||||||
|
@ -158,6 +159,7 @@ func TestViewIssuesKeyword(t *testing.T) {
|
||||||
assertMatch(t, issue, keyword)
|
assertMatch(t, issue, keyword)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestViewIssuesSearchOptions(t *testing.T) {
|
func TestViewIssuesSearchOptions(t *testing.T) {
|
||||||
defer tests.PrepareTestEnv(t)()
|
defer tests.PrepareTestEnv(t)()
|
||||||
|
|
Loading…
Reference in a new issue