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

Implementing Fuzzy Search with OData #1362

Open
starshinata opened this issue Nov 27, 2024 · 6 comments
Open

Implementing Fuzzy Search with OData #1362

starshinata opened this issue Nov 27, 2024 · 6 comments

Comments

@starshinata
Copy link

Hi everyone,

Our team is currently working on a project where the client requirement is to implement fuzzy search. However, we have noticed that OData does not support fuzzy search out of the box.

We would like to inquire if there is a recommended approach to achieve this functionality using OData.

We are looking at implementing a custom filter option such as: odata/profiles?$filter=fuzzy(FirstName, 'John') where we can provide a custom implementation for this filter, using a third-party library, in a way that integrates with OData.

However, we are open to other suggestions as well.

Could you please advise us on the best way to approach this? Any guidance, examples, or references to relevant documentation would be greatly appreciated.

Thank you for your assistance.

@julealgon
Copy link
Contributor

I believe the best extension point to add support for this in odata would be to use the built-in $search query. You can implement anything you want behind that operation.

I'd either go with that, or as a fallback I'd write a custom bound action on the entityset.

@starshinata
Copy link
Author

Thanks a lot for the help, @julealgon!

@Mhirji
Copy link

Mhirji commented Nov 27, 2024

@starshinata , based on the example you provided in terms of what you are trying to achieve, unless you require a percentage on the probability of the match, you could also use the "contains" operator. This would translate to a like in SQL.

@mikepizzo
Copy link
Member

Note that OASIS is considering adding a new search function that could be used in $filter. The only advantage of this over $search is that you could combine the fuzzy search in more ways $search, which is always AND'd with any $filter.

Would such a function, if introduced, be useful to folks?

@marabooy
Copy link
Member

marabooy commented Dec 3, 2024

@starshinata Do the two workarounds for $search and $filter with contains work for you? Also, please review Mike's post to see if the newly proposed search function suits your case.

@julealgon
Copy link
Contributor

julealgon commented Dec 3, 2024

@mikepizzo

Note that OASIS is considering adding a new search function that could be used in $filter. The only advantage of this over $search is that you could combine the fuzzy search in more ways $search, which is always AND'd with any $filter.

Would such a function, if introduced, be useful to folks?

Interesting suggestion. I assume the more specific search function (the one inside $filter) would then also be implementation-dependent, like the external one is today.

I do think it makes sense for the added flexibility it gives.

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

No branches or pull requests

5 participants