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
@@ -14,26 +14,27 @@ var searchTermPuncStart = regexp.MustCompile(`^[^\pL\d\s#"]+`)
|
||||
var searchTermPuncEnd = regexp.MustCompile(`[^\pL\d\s*"]+$`)
|
||||
|
||||
type SearchParams struct {
|
||||
Terms string
|
||||
ExcludedTerms string
|
||||
IsHashtag bool
|
||||
InChannels []string
|
||||
ExcludedChannels []string
|
||||
FromUsers []string
|
||||
ExcludedUsers []string
|
||||
AfterDate string
|
||||
ExcludedAfterDate string
|
||||
BeforeDate string
|
||||
ExcludedBeforeDate string
|
||||
Extensions []string
|
||||
ExcludedExtensions []string
|
||||
OnDate string
|
||||
ExcludedDate string
|
||||
OrTerms bool
|
||||
IncludeDeletedChannels bool
|
||||
TimeZoneOffset int
|
||||
Terms string `json:"terms,omitempty"`
|
||||
ExcludedTerms string `json:"excluded_terms,omitempty"`
|
||||
IsHashtag bool `json:"ishashtag,omitempty"`
|
||||
InChannels []string `json:"in_channels,omitempty"`
|
||||
ExcludedChannels []string `json:"excluded_channels,omitempty"`
|
||||
FromUsers []string `json:"from_users,omitempty"`
|
||||
ExcludedUsers []string `json:"excluded_users,omitempty"`
|
||||
AfterDate string `json:"after_date,omitempty"`
|
||||
ExcludedAfterDate string `json:"excluded_after_date,omitempty"`
|
||||
BeforeDate string `json:"before_date,omitempty"`
|
||||
ExcludedBeforeDate string `json:"excluded_before_date,omitempty"`
|
||||
Extensions []string `json:"extensions,omitempty"`
|
||||
ExcludedExtensions []string `json:"excluded_extensions,omitempty"`
|
||||
OnDate string `json:"on_date,omitempty"`
|
||||
ExcludedDate string `json:"excluded_date,omitempty"`
|
||||
OrTerms bool `json:"or_terms,omitempty"`
|
||||
IncludeDeletedChannels bool `json:"include_deleted_channels,omitempty"`
|
||||
TimeZoneOffset int `json:"timezone_offset,omitempty"`
|
||||
// True if this search doesn't originate from a "current user".
|
||||
SearchWithoutUserId bool
|
||||
SearchWithoutUserId bool `json:"search_without_userid,omitempty"`
|
||||
Modifier string `json:"modifier"`
|
||||
}
|
||||
|
||||
// Returns the epoch timestamp of the start of the day specified by SearchParams.AfterDate
|
||||
|
||||
Ссылка в новой задаче
Block a user