Skip to content

Conversation

@Geoffry304
Copy link
Contributor

Add the force case insensitive to make the search case insensitive for searching in json fields, for example translation fields.

Copied the code from the Filament Resource and added the current resource to the function.

Add the force case insensitive to make the search case insensitive for searching in json fields, for example translation fields.

Copied the code from the Filament Resource and added the current resource to the function
@pxlrbt
Copy link
Owner

pxlrbt commented Nov 18, 2024

Sorry, closing this as the PR is a bit old and I don't fully understand all the changes. Happy to reopen if you are still interested.

@pxlrbt pxlrbt closed this Nov 18, 2024
@Geoffry304
Copy link
Contributor Author

Geoffry304 commented Nov 18, 2024

Hello

If you have a field that you store in the database as json and you try to search on this when resource 'isGlobalSearchForcedCaseInsensitive' is set to true then the record will not be displayed when you go to search CaseInsensitive.

{"de": "GROEP DE", "en": "GROEP EN", "fr": "GROEP FR", "nl": "Groep NL"}
class ProductGroupResource extends Resource
{
    protected static ?string $model = ProductGroup::class;

    protected static ?int $navigationSort = 11;

    protected static ?string $recordTitleAttribute = 'description';

    protected static ?bool $isGlobalSearchForcedCaseInsensitive = true;

...

This is what you get when using the code in my pull request:
image
image

And this is what you get when using your code:
image
image

I hope it is more clear now :)

@pxlrbt pxlrbt reopened this Nov 18, 2024
@pxlrbt pxlrbt merged commit 9955742 into pxlrbt:main Nov 18, 2024
1 check passed
@pxlrbt
Copy link
Owner

pxlrbt commented Nov 18, 2024

I had to create a new PR since I couldn't push changes to your branch. #50

@pxlrbt
Copy link
Owner

pxlrbt commented Nov 18, 2024

Thank you!

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

Successfully merging this pull request may close these issues.

2 participants