Skip to content

.Net: Change the return type of ITextSearch to align with search abstractions in M.E.VD #11782

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

markwallace-microsoft
Copy link
Member

Motivation and Context

Description

Contribution Checklist

…- Phase 1 (#11519)

### Motivation and Context

1. Change the return type of ITextSearch to align with search
abstractions in M.E.VD
2. Make `top` a required parameter to align with search abstractions in
M.E.VD

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
### Motivation and Context

1. Update BraveTextSearch to use latest `ITextSearch`
2. Add integration tests

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
@markwallace-microsoft markwallace-microsoft requested a review from a team as a code owner April 28, 2025 18:44
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core labels Apr 28, 2025
@markwallace-microsoft markwallace-microsoft force-pushed the feature-itextsearch-alignment branch from b45637a to 3d1f86f Compare May 6, 2025 15:27
/// <returns>A <see cref="KernelPlugin"/> instance with a Search operation that calls the provided <see cref="ITextSearch.SearchAsync(string, TextSearchOptions?, CancellationToken)"/>.</returns>
[RequiresUnreferencedCode("Uses reflection to handle various aspects of the function creation and invocation, making it incompatible with AOT scenarios.")]
[RequiresDynamicCode("Uses reflection to handle various aspects of the function creation and invocation, making it incompatible with AOT scenarios.")]
public static KernelPlugin CreateWithSearch(this ITextSearch textSearch, int top, string pluginName, string? description = null)
Copy link
Contributor

Choose a reason for hiding this comment

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

I've been struggling with these names, since they don't actually tell you what it's creating.
Since you call it on textsearch, it sounds like it's creating a textsearch, but that doesn't really make sense since you already have a textsearch instance.
The different overloads also don't really clearly tell me what I'm going to get. I always need to go and look at the code to try and figure out if I'm going to get back a string only or one of the other types.
Since we are introducing new methods this may be a good opportunity to revisit the naming.

An alternative naming scheme:
ToSearchPlugin
ToCitationSearchPlugin
ToProviderSearchPlugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel.core kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants