-
Notifications
You must be signed in to change notification settings - Fork 333
[SQSERVICES-1828] pagination of team members does not work properly for certain team sizes #2968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
187d449
58f8222
2fb585e
a741fba
a0f3b8c
04d7879
b19a3b3
942420f
4d880da
3a79680
203c5fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix pagination in team user search in case of a non-unique search key | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,12 +102,25 @@ teamUserSearchQuery tid mbSearchText _mRoleFilter mSortBy mSortOrder = | |
| mbQStr | ||
| ) | ||
| teamFilter | ||
| ( maybe | ||
| -- in combination with pagination a non-unique search specification can lead to missing results | ||
| -- therefore we use the unique `_doc` value as a tie breaker | ||
| -- - see https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-request-sort.html for details on `_doc` | ||
| -- - see https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-request-search-after.html for details on pagination and tie breaker | ||
| -- in the latter article it "is advised to duplicate (client side or with a set ingest processor) the content of the _id field | ||
|
battermann marked this conversation as resolved.
Outdated
|
||
| -- in another field that has doc value enabled and to use this new field as the tiebreaker for the sort" | ||
| -- so alternatively we could use the user ID as a tie breaker, but this would require a change in the index mapping | ||
| (sorting ++ sortingTieBreaker) | ||
| where | ||
| sorting :: [ES.DefaultSort] | ||
| sorting = | ||
| maybe | ||
| [defaultSort SortByCreatedAt SortOrderDesc | isNothing mbQStr] | ||
| (\tuSortBy -> [defaultSort tuSortBy (fromMaybe SortOrderAsc mSortOrder)]) | ||
| mSortBy | ||
| ) | ||
| where | ||
|
|
||
|
battermann marked this conversation as resolved.
Outdated
|
||
| sortingTieBreaker :: [ES.DefaultSort] | ||
| sortingTieBreaker = [ES.DefaultSort (ES.FieldName "_doc") ES.Ascending Nothing Nothing Nothing Nothing] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure, but this looks like something different from what the docs you are linking suggest, and it may be prohibitively inefficient. Can you try the _id trick that you were about to try? That may require an ES migration, but we've done those before, and ES doesn't server as a source of truth and in the worst case can recover from Cassandra. So I'm not too worried. |
||
|
|
||
| mbQStr :: Maybe Text | ||
| mbQStr = | ||
| case mbSearchText of | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.