Open Closed

Disable Case Sensitive Filter #5149


User avatar
0
hanntd created
  • ABP Framework version: v7.2.2
  • UI type: Blazor
  • DB provider: Postgres
  • Tiered (MVC) or Identity Server Separated (Angular): yes Hi, How to disable case sensitive filter when searching as we are using Postgres. Thanks Dharma Han Nguyen

10 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I think this is the setting of the database.

    https://docs.aws.amazon.com/dms/latest/sql-server-to-aurora-postgresql-migration-playbook/chap-sql-server-aurora-pg.sql.casesensitivity.html

  • User Avatar
    0
    hanntd created

    hi

    I think this is the setting of the database.

    https://docs.aws.amazon.com/dms/latest/sql-server-to-aurora-postgresql-migration-playbook/chap-sql-server-aurora-pg.sql.casesensitivity.html

    I don't mean for table name but I mean for the content/data we input to search, for example we have the original data as below: Then I input "blazor" to filter data and nothing can be fitlered: But if I input exactly as data stored in the database "Blazor", the result is ok and can be filtered:

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The search will be a SQL query and the database will decide whether toCase Sensitive

    eg

    select * from table where displayName == "%Blazor%"
    
  • User Avatar
    0
    hanntd created

    Hi, How we can fix this problem so that user can input data to search regardless of case sensitive. I'm using Abp Suite to generate UI and Service and faced with this issue for the default search on the generated UI. Thanks Dharma (Han Nguyen)

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You should change your database the code is no problem.

    https://www.npgsql.org/efcore/misc/collations-and-case-sensitivity.html?tabs=data-annotations

  • User Avatar
    0
    hanntd created

    Hi,

    Is there any way to change in code because when creating the solution with ABP its always create postgres case sensitive db as default during run db migration. Can we apply such as ILIKE in ABP generated code for searching?

    Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Is there any way to change in code because when creating the solution with ABP its always create postgres case sensitive db as default during run db migration.

    Can only be changed manually

    Can we apply such as ILIKE in ABP generated code for searching?

    https://www.npgsql.org/efcore/misc/collations-and-case-sensitivity.html#ilike

  • User Avatar
    0
    hanntd created

    Hi, I tried to create a new collation in Postgres to support case insensitive and create test table with columns associated with this new collation: CREATE COLLATION english_ci ( PROVIDER = 'icu', LOCALE = 'en-US@colStrength=secondary', DETERMINISTIC = FALSE )

    But when I search on the page generated by ABP Suite it throw the error:

    Do you have any sample to handle for this case?

  • User Avatar
    0
    Buckoge created

    Maybe this can help :-) In EntityFrameworkCore add ToLower()

    .WhereIf(!string.IsNullOrWhiteSpace(filterText), e => e.Name.ToLower().Contains(filterText.ToLower())) .WhereIf(!string.IsNullOrWhiteSpace(name), e => e.Name.ToLower().Contains(name.ToLower()));

  • User Avatar
    0
    hanntd created

    Maybe this can help :-) In EntityFrameworkCore add ToLower()

    .WhereIf(!string.IsNullOrWhiteSpace(filterText), e => e.Name.ToLower().Contains(filterText.ToLower())) .WhereIf(!string.IsNullOrWhiteSpace(name), e => e.Name.ToLower().Contains(name.ToLower()));

    Thanks Buckoge

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11