POC: Cross-team recent search (#20027)
Just a quick POC to move fast :P We use a search pointer to keep track of the next row to inesrt to. For every new search we increment the pointer and do modulo 5. This means that the value will always remain between 0-4. And that way, we will always overwrite the oldest entry on every search. And while getting the results, we get all results for that user. The search parameters are json marshalled and stored as a JSON blob. This is because there is no need to search/filter them in the DB. Pending items: Tests obviously. To improve: The client needs to send the channel ids instead of channel names.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
979b616189
Коммит
aa59c28b04
@@ -1268,7 +1268,7 @@ func populateZipfile(w *zip.Writer, fileDatas []model.FileData) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) SearchFilesInTeamForUser(c *request.Context, terms string, userId string, teamId string, isOrSearch bool, includeDeletedChannels bool, timeZoneOffset int, page, perPage int) (*model.FileInfoList, *model.AppError) {
|
||||
func (a *App) SearchFilesInTeamForUser(c *request.Context, terms string, userId string, teamId string, isOrSearch bool, includeDeletedChannels bool, timeZoneOffset int, page, perPage int, modifier string) (*model.FileInfoList, *model.AppError) {
|
||||
paramsList := model.ParseSearchParams(strings.TrimSpace(terms), timeZoneOffset)
|
||||
includeDeleted := includeDeletedChannels && *a.Config().TeamSettings.ExperimentalViewArchivedChannels
|
||||
|
||||
@@ -1279,6 +1279,7 @@ func (a *App) SearchFilesInTeamForUser(c *request.Context, terms string, userId
|
||||
finalParamsList := []*model.SearchParams{}
|
||||
|
||||
for _, params := range paramsList {
|
||||
params.Modifier = modifier
|
||||
params.OrTerms = isOrSearch
|
||||
params.IncludeDeletedChannels = includeDeleted
|
||||
// Don't allow users to search for "*"
|
||||
|
||||
Ссылка в новой задаче
Block a user