Open Closed

How to support accent-insensitive and relational field search #9218


User avatar
0
thanhlg created

Hi ABP Team,
We are developing a Blazor Web App using the ABP Framework with a PostgreSQL database.
We want to implement accent-insensitive search and searching by foreign key display fields in list filters. Currently, ABP Suite generates default "GetListAsync" paging and filtering logic, which works well for simple fields, but we need to modify it to:

  1. Support accent-insensitive search (e.g., searching "chao" should return records with "chào" or "cháo").

  2. Allow searching by foreign key display fields (e.g., searching for 'Company.Name' instead of just 'CompanyId').

Here’s an example:

User table:

Id Name CompanyId
1 John Doe 3
2 Jane Smith 2

Company table:

Id Name
1 ABC Corp
2 XYZ Ltd
3 Acme Inc

We would like to customize ABP Suite templates to generate code that allows searching by "Company.Name" (e.g., search for "Acme Inc") instead of only filtering by "CompanyId".
Is there a recommended way to customize ABP Suite templates to achieve this functionality?
We appreciate any guidance or examples you can provide.

Best regards,
Jiaqing


3 Answer(s)
  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hello thanhlg 🙋‍♂️,

    You can use this article for a case-sensitive search. See: https://abp.io/community/articles/caseinsensitive-search-in-abp-basedpostgresql-application-c9kb05dc

    I can say that searching by foreign key fields is completely specific to your business. Therefore, you need to manually update the templates of AppService, Repository, and UI side.

    How to do this is explained in this document.

  • User Avatar
    0
    thanhlg created

    Hello thanhlg 🙋‍♂️,

    You can use this article for a case-sensitive search. See: https://abp.io/community/articles/caseinsensitive-search-in-abp-basedpostgresql-application-c9kb05dc

    I can say that searching by foreign key fields is completely specific to your business. Therefore, you need to manually update the templates of AppService, Repository, and UI side.

    How to do this is explained in this document.

    Hi berkansasmaz,

    Thanks for the helpful article on case-insensitive search with EF.Functions.ILike(). It works for case-insensitivity, but we're specifically looking for a solution for accent-insensitive search (e.g., searching "chao" should match "chào" or "cháo").

    Is there a way to handle accent-insensitive search purely within the ABP Framework (possibly through a custom string comparison method or a helper function) without relying on PostgreSQL's unaccent()?

    We'd like to avoid extending PostgreSQL and instead keep the logic within the application code.

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hello thanhlg 👋,

    For this, I can recommend normalizing the sent filter. Actually, this is a very popular topic and there are a few packages for this, and I can recommend you to use them. You can check this stackoverflow question for more. https://stackoverflow.com/questions/249087/how-do-i-remove-diacritics-accents-from-a-string-in-net

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on May 15, 2025, 10:28