Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PG LIKE search within isArray columns #368

Open
@TrilipuT

Description

Hey there!

I have one issue that i have solved but seems like I didn't get to the cause of it.
So when I'm using isArray for field and substringSearch: true it sets additional " into value
See 063 in the query.

🪲📜 PG Q: SELECT "id", "plate", "name", "phones", "status", "type", "building", "flat", "created_at", "updated_at", "expire_at", "comments", "is_us_plate" FROM "vehicle" WHERE "phones" ILIKE 1ドル AND "status" IS DISTINCT FROM 2ドル AND "building" = 3ドル ORDER BY "id" DESC LIMIT 4ドル OFFSET 5ドル params: [ '%"063"%', 2, 'b4', 50, 0 ]
🪲📜 PG Q: SELECT COUNT(*) FROM "vehicle" WHERE "phones" ILIKE 1ドル AND "status" IS DISTINCT FROM 2ドル AND "building" = 3ドル values: [ '%"\\"063\\""%', 2, 'b4' ]

so seems like those quotes are ambigious for like query.
I found only one way is to replace it. In file postgres data connector. But i think that might have a better way to solve it.

if (filter.operator == AdminForthFilterOperators.LIKE || filter.operator == AdminForthFilterOperators.ILIKE) {
 let value = filter.value.replaceAll('"','');
 value = value.replaceAll('\\','');
 return [`%${value}%`];
}

Here's my column setup

{
 name: 'phones',
 type: AdminForthDataTypes.JSON,
 isArray: {
 enabled: true,
 itemType: AdminForthDataTypes.STRING,
 },
 minLength: 12,
 filterOptions: {
 debounceTimeMs: 800,
 substringSearch: true,
 },
}

Please let me know if that can be fixed somehow...
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /