Skip to content

feat(AutoComplete): update UseElasticSearch method signature#749

Merged
MayueCif merged 1 commit intomainfrom
refactor/UseElasticSearch
Jun 4, 2025
Merged

feat(AutoComplete): update UseElasticSearch method signature#749
MayueCif merged 1 commit intomainfrom
refactor/UseElasticSearch

Conversation

@MayueCif
Copy link
Contributor

@MayueCif MayueCif commented Jun 4, 2025

Changed the parameter type of the UseElasticSearch method in AutoCompleteOptionsExtensions.cs from Action<ElasticSearchAutoCompleteOptions> to Action<IServiceProvider, ElasticSearchAutoCompleteOptions>. Updated internal method calls accordingly to pass the IServiceProvider instance.

Modified all calls to UseElasticSearch in AutoCompleteTest.cs to accommodate the new method signature, ensuring proper passing of IServiceProvider and ElasticSearchAutoCompleteOptions instances.

These changes enhance the flexibility of the UseElasticSearch method, allowing access to the service provider for configuring ElasticSearchAutoCompleteOptions with additional services and dependencies.

Changed the parameter type of the `UseElasticSearch` method in `AutoCompleteOptionsExtensions.cs` from `Action<ElasticSearchAutoCompleteOptions>` to `Action<IServiceProvider, ElasticSearchAutoCompleteOptions>`. Updated internal method calls accordingly to pass the `IServiceProvider` instance.

Modified all calls to `UseElasticSearch` in `AutoCompleteTest.cs` to accommodate the new method signature, ensuring proper passing of `IServiceProvider` and `ElasticSearchAutoCompleteOptions` instances.

These changes enhance the flexibility of the `UseElasticSearch` method, allowing access to the service provider for configuring `ElasticSearchAutoCompleteOptions` with additional services and dependencies.
@wzh425 wzh425 requested a review from Copilot June 4, 2025 06:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the UseElasticSearch method signature to include an IServiceProvider parameter, enhancing flexibility by enabling dependency injection during the configuration of ElasticSearchAutoCompleteOptions.

  • Updated the UseElasticSearch method in AutoCompleteOptionsExtensions.cs to pass IServiceProvider into the action callback.
  • Modified all test call sites in AutoCompleteTest.cs to use a two-parameter lambda, accommodating the new method signature.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Contrib/SearchEngine/AutoComplete/Tests/Masa.Contrib.SearchEngine.AutoComplete.ElasticSearch.Tests/AutoCompleteTest.cs Updated test lambdas to include and pass along the unused serviceProvider parameter with the new method signature.
src/Contrib/SearchEngine/AutoComplete/Masa.Contrib.SearchEngine.AutoComplete.ElasticSearch/Extensions/AutoCompleteOptionsExtensions.cs Updated the UseElasticSearch extension to invoke the action with both serviceProvider and elasticSearchAutoCompleteOptions.
Comments suppressed due to low confidence (1)

src/Contrib/SearchEngine/AutoComplete/Tests/Masa.Contrib.SearchEngine.AutoComplete.ElasticSearch.Tests/AutoCompleteTest.cs:25

  • The 'serviceProvider' parameter is currently unused in the lambda. To improve code clarity and indicate its intentional omission, consider renaming it to '_serviceProvider' or using a discard if supported.
autoCompleteOptions.UseElasticSearch((serviceProvider, options) =>

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 4, 2025

@MayueCif MayueCif merged commit 618fe45 into main Jun 4, 2025
3 checks passed
@MayueCif MayueCif deleted the refactor/UseElasticSearch branch June 4, 2025 06:59
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