Skip to content
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

Use the language search profile if available #289

Merged
merged 4 commits into from
Sep 9, 2022
Merged

Conversation

micgro42
Copy link
Collaborator

@micgro42 micgro42 commented Sep 9, 2022

Bug: T312853

@github-actions
Copy link

github-actions bot commented Sep 9, 2022

@micgro42 micgro42 marked this pull request as ready for review September 9, 2022 12:49
Copy link
Member

@lucaswerkmeister lucaswerkmeister left a comment

Choose a reason for hiding this comment

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

LGTM overall

index.html Outdated Show resolved Hide resolved
public async searchItems( searchTerm: string, offset?: number ): Promise<SearchedItemOption[]> {
const additionalParams: Record<string, string> = {};
if ( this.availableSearchProfiles.includes( this.LANGUAGE_PROFILE_NAME ) ) {
additionalParams.profile = this.LANGUAGE_PROFILE_NAME;
Copy link
Member

Choose a reason for hiding this comment

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

We could also move this into the constructor, right? (And then maybe even discard this.availableSearchProfiles.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure if I fully understand what you are suggesting. I adjusted it a bit. Let me know what you think

Copy link
Member

Choose a reason for hiding this comment

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

What I had in mind was that even the additionalParams could be a class member, but I’m also okay with just having the useLanguageProfile boolean there.

src/plugins/ItemSearchPlugin/LanguageItemSearch.ts Outdated Show resolved Hide resolved
tests/unit/data-access/LanguageItemSearcher.test.ts Outdated Show resolved Hide resolved
micgro42 and others added 3 commits September 9, 2022 16:13
Co-authored-by: Lucas Werkmeister <lucas.werkmeister@wikimedia.de>
Co-authored-by: Lucas Werkmeister <lucas.werkmeister@wikimedia.de>
@micgro42 micgro42 merged commit 1ce61b9 into main Sep 9, 2022
@micgro42 micgro42 deleted the useSearchProfiles branch September 9, 2022 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants