Home > Back-end >  How to search json column in Sonata?
How to search json column in Sonata?

Time:12-13

I have column in my db where data looks like this "{"cs":"L\u00e9ka\u0159","en":"Doctor","_type":"translated"}" I need to perform fulltext search like shown in screenshot and I have no idea how to do it. Is there any way how to extract data from db and then perform search on this? I couldn't find any mention of it in documentation. Maybe there is some simple solution which I can't see, thank you for your help. enter image description here

I tried to solve it by raw sql query but sonata for it's filters expects instance of QueryBuilder. I also tried to change column's collation, but it didn't help.

CodePudding user response:

It turned out I'm completely blind. If somebody would run into this problem in the future, there is possibility to create custom filter like it is described here. https://docs.sonata-project.org/projects/SonataDoctrineORMAdminBundle/en/4.x/reference/filter_field_definition/#jsonlistfilter-and-custom-filters

  • Related