fix(task): ambiguous description search (#1032)

test: relocate search regression
This commit is contained in:
kolaente 2025-06-26 22:05:04 +02:00 committed by GitHub
parent bddba8646d
commit c6c18d1ca1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 1 deletions

View File

@ -78,3 +78,21 @@ func TestTaskCollection_SubtaskRemainsAfterMove(t *testing.T) {
}
assert.True(t, found, "subtask should be returned after moving to another project")
}
func TestTaskSearchWithExpandSubtasks(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()
defer s.Close()
project, err := GetProjectSimpleByID(s, 36)
require.NoError(t, err)
opts := &taskSearchOptions{
search: "Caldav",
expand: []TaskCollectionExpandable{TaskCollectionExpandSubtasks},
}
tasks, _, _, err := getRawTasksForProjects(s, []*Project{project}, &user.User{ID: 15}, opts)
require.NoError(t, err)
require.NotEmpty(t, tasks)
}

View File

@ -283,7 +283,7 @@ func (d *dbTaskSearcher) Search(opts *taskSearchOptions) (tasks []*Task, totalCo
where =
builder.Or(
db.ILIKE("tasks.title", opts.search),
db.ILIKE("description", opts.search),
db.ILIKE("tasks.description", opts.search),
)
searchIndex := getTaskIndexFromSearchString(opts.search)