Skip to content

Conversation

@mkovalua
Copy link
Contributor

@mkovalua mkovalua commented Nov 4, 2025

Purpose

Some user workflows rely on using the OSF profile identifiers to locate users reliably. This was possible previously (at least in most contributor searches), but is not any longer.

Summary of Changes

When adding contributors, searching by user GUID should call up that user. This can be implemented across all instances of this widget/modal. Requires API change

Screenshot(s)

image

Side Effects

QA Notes

const baseUrl = `${this.apiUrl}/users/?filter[full_name]=${value}&page=${page}`;
searchUsers(value: string, page = 1, findById = false): Observable<PaginatedData<ContributorAddModel[]>> {
const filterParamName = findById ? 'id' : 'full_name';
const baseUrl = `${this.apiUrl}/users/?filter[${filterParamName}]=${value}&page=${page}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should be using the search api endpoint for this. For example, https://api.osf.io/v2/search/users/?q=typ46 or https://api.osf.io/v2/search/users/?q=brian%20geiger.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianjgeiger it was/is used with the following api call

https://api.staging3.osf.io/v2/users/?filter[full_name]=pavlo&page=1 to get users for the modal ( from my point of view it works as expected or do you see something wrong)

image

and we may reuse that call for guid by using 'id' as filter when it is needed

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filtering on the user column is slower and more processor intensive than using the search endpoint, which uses elastic to do the searching. Also, how do you know which filter parameter to use? If you were going the filtering route, I believe it would save some trouble to filter[id,full_name]=<query string>. But I think the search endpoint is the better way to do that.

I just tested, and the search endpoint is much faster.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianjgeiger

Also, how do you know which filter parameter to use?

I have made an attempt to filter by id and it was succeeded (otherwise might look to some alternative approach)

image

I just tested, and the search endpoint is much faster.

on ?search it is needed to have full match when typing so it may be a reason (if we change existed approach with ?search, i think it breaks UX and user expectations, when they type something not to end)

170b-2d6b-4d73-90bb-5b63a89f3a08.mp4
1ee5-db6c-44f1-b32b-6305720b51a8.mp4

also not see much difference when use search in comparison with current appoach for guid ( but if needed we may apply search for this case, because we need full match)

image image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try your time experiments on Production rather than localhost to see the difference in speed.

Also, definitely don't make two requests, one for fullname and one for id. Use the combined filter[fullname,id]=<query> approach instead.

You can get search to substring words by using wildcard characters (bri* will match on brian, for example).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianjgeiger

I have tried to compare for staging3 back end (

if it is ok when you tell for experiments on Production

have CORS error to test local front end with PROD

image

)

const baseUrl = ${this.apiUrl}/users/?filter[full_name,id]=${value}&page=${page};
const baseUrl = ${this.apiUrl}/search/users/?q=${value}*&page=${page};

from my point of view ?filter[full_name,id] is even faster (and we may search by id only if searchString.length === 5 and it may be even more faster),

but if you see it is faster with search? with more data for prod we may replace it with search?

613c-ef81-436e-befc-7dea6d79a99b.mp4

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just visit the URLs in the browser to test on Prod, you don't have to use the front end to test the speed.

Searching by length==5 is a potential optimization, but if we go with filtering, for now I think just keeping it simple would be fine.

Copy link
Contributor Author

@mkovalua mkovalua Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianjgeiger thanks

image

I have tested for PROD both for some requests users/?filter and /search/users/? and /search looks to be faster when we have many records

https://api.osf.io/v2/users/?filter[full_name,id]=epcad&page=1

https://api.osf.io/v2/search/users/?q=epcad*&page=1

have updated code to be it faster when we have many records

https://github.com/CenterForOpenScience/angular-osf/pull/743/files

@mkovalua mkovalua requested a review from brianjgeiger November 4, 2025 21:47
@mkovalua mkovalua requested a review from nsemets November 5, 2025 17:13
nsemets
nsemets previously approved these changes Nov 6, 2025
@brianjgeiger brianjgeiger changed the base branch from feature/pbs-25.03 to feature/pbs-25.04 November 6, 2025 20:58
@brianjgeiger brianjgeiger dismissed nsemets’s stale review November 6, 2025 20:58

The base branch was changed.

@brianjgeiger brianjgeiger merged commit 40e63f3 into CenterForOpenScience:feature/pbs-25.04 Nov 6, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants